| View previous topic :: View next topic |
| Author |
Message |
OSIRIS Grandmaster Cheater
Reputation: 0
Joined: 27 Aug 2006 Posts: 654
|
Posted: Wed Mar 12, 2008 3:01 pm Post subject: [HELP VB2008] Stop an Application |
|
|
So so I goggled a code on how to kill a process. I got this
| Code: |
Dim pList() As System.Diagnostics.Process = _
System.Diagnostics.Process.GetProcessesByName("notepad")
For Each proc As System.Diagnostics.Process In pList
Dim resp As MsgBoxResult
resp = MsgBox("Terminate " & proc.ProcessName & "?", _
MsgBoxStyle.YesNo, "Terminate?")
If resp = MsgBoxResult.Yes Then
proc.Kill()
End If
Next
|
I understand this code completly it just closed notepad, but what if I didnt want a message box to appear? I just want the process to end immediately. I tried to modify the code to take out the message box but it was to hard. So if someone could please help me
Also I know the past few days I have been asking like 20 questions a day and posting usless crap, but im just learning this language and soon I will be able to help you guys out  |
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Wed Mar 12, 2008 3:05 pm Post subject: |
|
|
| Code: | Dim pList() As System.Diagnostics.Process = _
System.Diagnostics.Process.GetProcessesByName("notepad")
For Each proc As System.Diagnostics.Process In pList
proc.Kill()
Next |
Wasn't really that hard.. I even did it in notepad. _________________
- Retired. |
|
| Back to top |
|
 |
OSIRIS Grandmaster Cheater
Reputation: 0
Joined: 27 Aug 2006 Posts: 654
|
Posted: Wed Mar 12, 2008 3:08 pm Post subject: |
|
|
| Wiccaan wrote: | | Code: | Dim pList() As System.Diagnostics.Process = _
System.Diagnostics.Process.GetProcessesByName("notepad")
For Each proc As System.Diagnostics.Process In pList
proc.Kill()
Next |
Wasn't really that hard.. I even did it in notepad. |
ty
+rep |
|
| Back to top |
|
 |
AndrewMan Grandmaster Cheater Supreme
Reputation: 0
Joined: 01 Aug 2007 Posts: 1257
|
Posted: Wed Mar 12, 2008 3:39 pm Post subject: |
|
|
I know he answered it but you just had to take out the For function.
In the beggining you're stating what you want to kill, and proc.kill actually "kills it". _________________
|
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Wed Mar 12, 2008 7:43 pm Post subject: |
|
|
| AndrewMan wrote: | I know he answered it but you just had to take out the For function.
In the beggining you're stating what you want to kill, and proc.kill actually "kills it". |
Wha? The loop is still intact. |
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Thu Mar 13, 2008 4:03 pm Post subject: |
|
|
| AndrewMan wrote: | I know he answered it but you just had to take out the For function.
In the beggining you're stating what you want to kill, and proc.kill actually "kills it". |
All I removed is the Msgbox check:
| Code: | Dim resp As MsgBoxResult
resp = MsgBox("Terminate " & proc.ProcessName & "?", _
MsgBoxStyle.YesNo, "Terminate?")
If resp = MsgBoxResult.Yes Then
// Keep The Kill Code That Was Here..
End If |
The loop is still there, the object was told to only add any proc that matched "notepad.exe" to the other, so the loop will kill all the notepad windows. There are more methods to be taken if you want to kill as specific Notepad window, but that was not the intended purpose. _________________
- Retired. |
|
| Back to top |
|
 |
Trow Grandmaster Cheater
Reputation: 2
Joined: 17 Aug 2006 Posts: 957
|
Posted: Fri Mar 14, 2008 7:47 pm Post subject: |
|
|
taskkill.exe in your system32 folder is also fun to use too, and im not sure about the advantage of it _________________
Get kidnapped often. |
|
| Back to top |
|
 |
samuri25404 Grandmaster Cheater
Reputation: 7
Joined: 04 May 2007 Posts: 955 Location: Why do you care?
|
Posted: Fri Mar 14, 2008 9:08 pm Post subject: |
|
|
| blland wrote: | | taskkill.exe in your system32 folder is also fun to use too, and im not sure about the advantage of it |
I'm pretty sure he's talking programatticaly _________________
|
|
| Back to top |
|
 |
|