Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Check if other .exe is running

Status
Not open for further replies.

kennedymr2

Programmer
May 23, 2001
594
AU
Would appreciate some help as to the best way to check if another .exe is running on the same computer

ie my program is prog1.exe
and i wish to check if prog5.exe is running

probably ideally, prog1.exe should start prog5.exe
and then prog1.exe would check every 5 seconds that prog5.exe is still running.

regards kennedymr2
 
Start off with the EnumProcess API call...

Happy hunting
 
It can be done using API functions

Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" ( _ ByVal lpClassName As Any, _ ByVal lpWindowName As String) As Long

Then you can use

windowHandle = FindWindow(vbNullString, "My Application Window Title")

If windowhandle = 0 then
'app not running
else
'app running
end if
 
The FindWindow-style solution all presuppose that an executable has a window. Whilst this will be true for most applications, it is not a given.
 
Thankyou all, very much for the advice and help offered.,
much appreciated.

shatch, the findwindows works fine.

As strongm mentioned, i have one program which does not expose a window.(but this does not matter in this case)


Thanks again.

Regards kennedymr2
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top