Ntohing_Trolll Ntohing_Trolll - 1 year ago 73
Vb.net Question

Finding a prorcess by name,indicating to user that the process run,then killing the process

I want to make a simple update application in vb.net,but,it cant update the file,cause the file is running.So,i want to find all processes called "seemta helper(this is how Task m. show it's name)"and,if,a process is running with that name,indicating to the user with a msgbox that the process is running,and,when the user press the OK button,then killing the process.

P.S. Sorry for bad english. :(

Answer Source

You can do this like this:

For Each p As Process In Process.GetProcessesByName("seemta helper")
    If MessageBox.Show("Kill " + p.ProcessName + "(" + p.Id + ")?", "Kill", MessageBoxButton.YesNo) = MessageBoxResult.Yes Then
    End If

GetProcessesByName() returns an array of running Process instances with the specified name.

Then you show a message box to ask the user if the process should be killed and if Yes is clicked, you call Kill() on that process's instance.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download