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!

Is Program running? 1

Status
Not open for further replies.

TheCrappyProgrammer

Programmer
Sep 17, 2001
41
US
In C++ MFC, what functions would determine whether a certain program is running and how would I terminate it? For Example, how would I make a program so that when the program detects that "solitaire.exe" is running, it automatically terminates "solitaire.exe"?
 
Use the Following APIs.
EnumProcesses - to retrieve all running processes Ids(you will need the files psapi.h and psapi.lib)
GetModuleFileName - to retrieve the name of the process by it's handle
OpenProcess - to get an handle to the process by its Id
TerminateProcess - to terminate a process.

HTH, s-)

Blessed is he who in the name of justice and goodwill, sheperds the weak through the valley of darkness...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top