|
20精币
50个大洋,求下面代码转成易语言.麻烦大牛了.
bool killProcess(PROCESS_INFORMATION & processInfo){
DWORD processId = processInfo.dwProcessId;
PROCESSENTRY32 processEntry = { 0 };
processEntry.dwSize = sizeof(PROCESSENTRY32);
//给系统内的所有进程拍一个快照
HANDLE handleSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
//遍历每个正在运行的进程
if (Process32First(handleSnap, &processEntry)){
BOOL isContinue = TRUE;
//终止子进程
do{
if (processEntry.th32ParentProcessID == processId){
HANDLE hChildProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, processEntry.th32ProcessID);
if (hChildProcess){
TerminateProcess(hChildProcess, 0);
CloseHandle(hChildProcess);
}
}
isContinue = Process32Next(handleSnap, &processEntry);
} while (isContinue);
HANDLE hBaseProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, processId);
if (hBaseProcess){
TerminateProcess(hBaseProcess, 0);
CloseHandle(hBaseProcess);
}
}
DWORD exitCode = 0;
GetExitCodeProcess(processInfo.hProcess, &exitCode);
cout << "exitCode=" << exitCode << endl;
if (exitCode == STILL_ACTIVE){
return false;
}
return true;
}
|
|