01-15-2011, 10:54 AM
Can someone help me with a code for getting the path of an open application running on the computer, then run the path of the open application. Please, anybody willing to help me out here?...
For Each Proc As Process In Process.GetProcesses()
Try
TextBox1.AppendText(Proc.MainModule.FileName & vbCrLf)
Catch
End Try
Next
(01-16-2011, 05:36 AM)thanasis2028 Wrote: [ -> ]Here is a piece of code I made that finds the location of the running apps:
Put this in a button or the form_load and add a TextBox with multiline set to true.Code:For Each Proc As Process In Process.GetProcesses()
Try
TextBox1.AppendText(Proc.MainModule.FileName & vbCrLf)
Catch
End Try
Next
Unfortunately, this does'nt work for all processes because some of them throw a runtime error. That's why I used Try-Catch. Remove it to see what happens.
For Each Proc As Process In Process.GetProcessesByName(TextBox2.Text)
Try
TextBox1.AppendText(Proc.MainModule.FileName & vbCrLf)
Catch
End Try
Next
(01-16-2011, 10:54 PM)thanasis2028 Wrote: [ -> ]Ok here is a way to do this:
Code:For Each Proc As Process In Process.GetProcessesByName(TextBox2.Text)
Try
TextBox1.AppendText(Proc.MainModule.FileName & vbCrLf)
Catch
End Try
Next
All I did was change GetProcesses to GetProcessesByName and added a textbox to input the name of the processs