Processes
-
Hey, Is there a way to check if an application is running in the Task Manager? and if it is kill it before starting my own custom process? I have the following function which sends a file to a printer but it opens up the application (e.g. MS Word) and sends the print command before closing it again.
Private Sub SendFileToPrinter()
Dim startinfo As New ProcessStartInfo startinfo.FileName = strFullFilePath startinfo.Verb = "print" startinfo.WindowStyle = ProcessWindowStyle.Hidden Process.Start(startinfo) End Sub
The problem is that sometimes it doesnt exit the application fully and it is still running in the background. Is the a way to get the location of the application .exe file that is running from the MIME type of the file, and then close it? thanks for your help Chris
-
Hey, Is there a way to check if an application is running in the Task Manager? and if it is kill it before starting my own custom process? I have the following function which sends a file to a printer but it opens up the application (e.g. MS Word) and sends the print command before closing it again.
Private Sub SendFileToPrinter()
Dim startinfo As New ProcessStartInfo startinfo.FileName = strFullFilePath startinfo.Verb = "print" startinfo.WindowStyle = ProcessWindowStyle.Hidden Process.Start(startinfo) End Sub
The problem is that sometimes it doesnt exit the application fully and it is still running in the background. Is the a way to get the location of the application .exe file that is running from the MIME type of the file, and then close it? thanks for your help Chris
This is what I've done. I hope it works to you. Private Sub KillProcess() procesos = Process.GetProcesses Dim p As Process For Each p In procesos If (p.ToString.LastIndexOf(nameOfProcessToKill) > 0) Then p.kill() Exit Sub End If Next End Sub E-mail me back would you? Regards, Carlos F chile