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;
) |