|
如果知道windows title,可以用findwindow
如果知道运行的文件名,可以用toolhelp api.
[code]
HANDLE hSnapShot;
HANDLE hPushAgentProcess = NULL;
BOOL bFlag;
hSnapShot = (HANDLE)CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS | 0x40000000,0);
if (hSnapShot == INVALID_HANDLE_VALUE)
{
return;
}
lpProcEntry.dwSize = sizeof(PROCESSENTRY32);
bFlag = Process32First(hSnapShot, &lpProcEntry );
while(bFlag)
{
if(wcsicmp(MyApp's Path, lpProcEntry.szExeFile) == 0)
{
break;
}
else
{
bFlag = Process32Next(hSnapShot,&lpProcEntry);
}
}
CloseToolhelp32Snapshot(hSnapShot); |
|