Page 1 of 1

Closing apps?

Posted: Wed Jul 25, 2012 2:05 pm
by CodenBoy
Yeah i know i need help again xD

How to close app? i can open them with
Code: Select all
process.start("notepad.exe")
but how to close?

Thanks

Re: Closing apps?

Posted: Wed Jul 25, 2012 2:21 pm
by comathi
Right below the Class declaration, just before the first Sub, put this:
Code: Select all
Dim app as Process
Wherever you want to start the process, use this:
Code: Select all
app=Process.Start("notepad.exe")
To kill the app, then use this:
Code: Select all
app.Kill()
Taken from http://www.dotnetperls.com/kill-vbnet

Re: Closing apps?

Posted: Wed Jul 25, 2012 5:14 pm
by CodenBoy
Thanks, will the kill code gonna close apps i didnt open? i dont think sp can u give me code to kill or close other apps i didnt open?


Thx brah loove;

Re: Closing apps?

Posted: Wed Jul 25, 2012 6:41 pm
by CodenBoy
Im back, thanks for this code but the one i need isnt this, cuz, I cant kill("notepad.exe") and i tried many others, didnt work,
and i need it to kill any thing not as this code, this cant work for what i need :)

Thanks

Re: Closing apps?

Posted: Wed Jul 25, 2012 7:32 pm
by M1z23R
Code: Select all
        For Each p As Process In System.Diagnostics.Process.GetProcesses
            If p.ProcessName.Contains("notepad") Then
                p.Kill()
            End If
        Next