Dark Slipstream Posted May 12, 2009 Report Posted May 12, 2009 (edited) You can kill a process in several ways, by using the process's Name, ID, Handle, MainWindowTitle, and more. The following sample will show you how to kill a process using the processes name and main window title. Error handling is provided to make sure it doesn't throw a False when it tries to kill a SYSTEM process. Public Function KillProcess(ByVal procName As String) As Boolean For Each p As Process In Process.GetProcesses If p.ProcessName.StartsWith(procName) Then Try p.Kill() Catch End Try ElseIf p.MainWindowTitle.StartsWith(procName) Then Try p.Kill() Catch End Try End If Next Return (True) End Function 'Usage' KillProcess("explorer") Edited February 14, 2010 by iBotPeaches 1
ixGAMEOVERxixx Posted August 15, 2009 Report Posted August 15, 2009 (edited) What about.. Process.GetProcessesByName(TextBox1.Text).Length = 0 Dim pProcess() As Process = System.Diagnostics.Process.GetProcessesByName(TextBox1.Text) For Each p As Process In pProcess p.Kill() Next ___http://vbnetsample.blogspot.com/2007/08/start-and-kill-process.html Edited August 16, 2009 by ixGAMEOVERxixx 1
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now