[C++] Find out if a program is running?
Moderator: General Moderators
[C++] Find out if a program is running?
How can I check if a program is running (on Windows) with C++? Some places suggest FindWindow or something like that, but all those suggestions are on newsgroups back in 1999 and 2000. I am using Dev-C++ (seems to support a most of VC++'s libraries). What method can I use to tell if a certain program is running? I am writing a monitoring app.
- Gente
- Forum Contributor
- Posts: 252
- Joined: Wed Jun 13, 2007 9:43 am
- Location: Ukraine, Kharkov
- Contact:
To be more specific http://msdn2.microsoft.com/en-us/library/ms682411.aspx
Do you want to monitor yopur own program (that you can modify) or do you want to monitor arbitrary programs?toasty2 wrote:What method can I use to tell if a certain program is running?
FindWindow is still a valid function.toasty2 wrote:Some places suggest FindWindow or something like that, but all those suggestions are on newsgroups back in 1999 and 2000
You might also be interested in EnumProcesses.
see also:
http://msdn2.microsoft.com/en-us/library/ms633499.aspx
http://msdn2.microsoft.com/en-us/library/ms682629.aspx
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
Alternatively you can look into: Process32First() and related functions...
This is perhaps of interest as well:
http://www.alexfedotov.com/articles/enumproc.asp
Cheers
This is perhaps of interest as well:
http://www.alexfedotov.com/articles/enumproc.asp
Cheers
No, I will be monitoring other programs (a few server apps). I plan on running a loop that every 30 seconds does whichever method I decide to use to check if the programs are running. Thanks everyone, I'll try using a few of these methods.volka wrote:Do you want to monitor yopur own program (that you can modify) or do you want to monitor arbitrary programs?
Edit: What library is FindWindow in?
feyd, I'm confused by CreateMutex, what is it exactly?
With the first method at http://www.alexfedotov.com/articles/enumproc.asp,
how do I check for a particular exe? How do I utilize the code?
how do I check for a particular exe? How do I utilize the code?
- stereofrog
- Forum Contributor
- Posts: 386
- Joined: Mon Dec 04, 2006 6:10 am
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
My best advice to you, would be to ask this question over at the codeproject.com a community of dedicated Windows developers. There is likely an article floating around somewhere.toasty2 wrote:With the first method at http://www.alexfedotov.com/articles/enumproc.asp,
how do I check for a particular exe? How do I utilize the code?
p.s-Why are you using Dev-C++
There is a free version of Visual C++ called Express. Far better for working on Windows apps than BloodShed. Unless you have plans on porting to Linux, in which case use the wxWidgets library and BloodShed.
http://msdn.microsoft.com/vstudio/express/visualc/
Cheers