I need some help with checking a process or if a certain window name is open on my project.
Right now what I have is:
FSXCheck = Timer
fsx.exe = Flight Simulator X
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
FSXCheck.Enabled = True
End Sub
Private Sub FSXCheck_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FSXCheck.Tick
Dim objWMIService, colProcesses
Dim Process As String
Process = "fsx.exe"
objWMIService = GetObject("winmgmts:")
colProcesses = objWMIService.ExecQuery("Select * from Win32_Process where name='" & Process & "'")
If colProcesses.Count Then
ToolStripStatusLabel1.Text = "FSX Status: Connected"
End If
End Sub
I Have the process down, but I need to figure out the
If colProcesses.Count Then
ToolStripStatusLabel1.Text = "FSX Status: Connected"
End If
And try to get it to say "FSX Status: Not Connected" when the process is not running, that is what I have a problem on.
If anyone could help, that'd be awesome. :)