- Apr 15, 2005
- 367
- 0
- 0
I have a snippet of code that needs to check every 10 seconds to see if a program is running. This is the code I currently have:
Dim loopcounter As String
loopcounter = "0"
Do Until loopcounter = "1"
Sleep(10000)
If Diagnostics.Process.GetProcessesByName("notepad").Length >= 1 Then
MessageBox.Show("notepad IS running")
Else
loopcounter = "1"
MessageBox.Show("notepad is Not running")
End If
Loop
Is this a good way I ask because it 'hangs' my app when checking as part of the loop or is it just the process or checking for the program?
TIA , J
Dim loopcounter As String
loopcounter = "0"
Do Until loopcounter = "1"
Sleep(10000)
If Diagnostics.Process.GetProcessesByName("notepad").Length >= 1 Then
MessageBox.Show("notepad IS running")
Else
loopcounter = "1"
MessageBox.Show("notepad is Not running")
End If
Loop
Is this a good way I ask because it 'hangs' my app when checking as part of the loop or is it just the process or checking for the program?
TIA , J