Check if a program is runningTag(s): WinAPI/Registry

OleObject locator,service,props
String ls_query = &
 'select name , description from Win32_Process where name = "textpad.exe"'
int num, ret, i
locator = CREATE OleObject
ret = locator.ConnectToNewObject("WbemScripting.SWbemLocator");
service = locator.ConnectServer();
props = service.ExecQuery(ls_query);
num = props.count()

IF num > 0 THEN
 MessageBox("Process","textpad.exe is running")
 Messagebox("Process","textpad.exe is NOT running")
Before using this technique, you may need to download and install the WMI ActiveX, here the URL.

See this related howto

blog comments powered by Disqus