Re: test if a program is running

new topic     » goto parent     » topic index » view thread      » older message » newer message
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

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu