#include <Tlhelp32.h>
- BOOL IsExistProcess(CONST CHAR* szProcessName)
- {
- PROCESSENTRY32 processEntry32;
- HANDLE toolHelp32Snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
- if (((int)toolHelp32Snapshot) != -1)
- {
- processEntry32.dwSize = sizeof(processEntry32);
- if (Process32First(toolHelp32Snapshot, &processEntry32))
- {
- do
- {
- if(strcmp(szProcessName ,processEntry32.szExeFile) == 0)
- {
- return TRUE;
- }
- }while (Process32Next(toolHelp32Snapshot, &processEntry32));
- }
- CloseHandle(toolHelp32Snapshot);
- }
-
- return FALSE;
- }
IsExistProcess("wwwwwwwwww.exe");