Exe is not to determine how to run?

Author:Anonymous    Updated:2008-10-17 12:15:29

We need to achieve in the code to determine whether the program has begun operation, today released the code to look at everyone and see!

 

 # include "Tlhelp32.h"

 bool CheckRunning (char * exe)

 (

 HANDLE handle = CreateToolhelp32Snapshot (TH32CS_SNAPPROCESS, 0);

 if (handle == NULL) false;

 PROCESSENTRY32 processinfo;

 processinfo.dwSize = sizeof (processinfo);

 bool status = Process32First (handle, & processinfo);

 while (status == true)

 (

 if (_stricmp (exe, processinfo.szExeFile) == 0)

 (

 CloseHandle (handle);

 return true;

 )

 status = Process32Next (handle, & processinfo);

 )

 CloseHandle (handle);

 return false;

 )

Previous:NO
Next:vc + + to limit the size of the window method
User Reviews
Site Search
Recommended article
AD