Re: test if a program is running
- Posted by jacques_desch Jul 09, 2009
- 1392 views
GeorgeWalters said...
I have a program that should not run if another different program is running. Does anyone have a routine to check to see of a program is running? I searched the user contributions but did not find anything I thought I could use or modify.
What platform, linux or windows?
if windows xp you could do something like this:
system("tasklist.exe | find "name_of_executable" > result.txt",2)
then open and read result.txt to see the program name is there.
Or use win32 api call to enumerate active process.
on linux you could do something like this:
system("ps | grep name_of_executable > result.txt",2)
Jacques