#include <windows.h>
#include <tlhelp32.h>
PROCESSENTRY32 pe32;
pe32.dwSize = sizeof(pe32);
HANDLE hProcessSnap = ::CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if(hProcessSnap == INVALID_HANDLE_VALUE)
{
theApp.WriteLogFile(" CreateToolhelp32Snapshot调用失败!");
return ;
}
BOOL bMore = ::Process32First(hProcessSnap, &pe32);
while(bMore)
{
if(stricmp("ScheduleSystem.exe",pe32.szExeFile)==0)
{
theApp.WriteLogFile("进程中还存在ScheduleSystem.exe程序!将关闭该进程!!");
::CloseHandle(hProcessSnap);
break;
}
bMore = ::Process32Next(hProcessSnap, &pe32);
}