bool isProcessRun(const wchar_t* processName)
{
HANDLE hSnap = NULL;
PROCESSENTRY32 pe32;
pe32.dwSize = sizeof(PROCESSENTRY32);
hSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if (hSnap != NULL)
{
if (Process32First(hSnap, &pe32))
{
if (lstrcmp(pe32.szExeFile, processName) == 0)
return TRUE;
while (Process32Next(hSnap, &pe32))
if (lstrcmp(pe32.szExeFile, processName) == 0)
return TRUE;
}
}
LI_FN(CloseHandle)(hSnap);
return FALSE;
}