在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
uses //================================ 以下是C++代码 void __fastcall TfrmMain::CloseProcess(AnsiString ProcessPath) { HANDLE hProcessSnap; PROCESSENTRY32 pe32; hProcessSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); if (hProcessSnap == (HANDLE)-1) return; memset(&pe32, 0, sizeof(pe32)); pe32.dwSize = sizeof(PROCESSENTRY32); if (Process32First(hProcessSnap, &pe32)) { do { if (ProcessPath.Pos((AnsiString)pe32.szExeFile)) { HANDLE hAndle = OpenProcess(SYNCHRONIZE|PROCESS_TERMINATE, false, pe32.th32ProcessID); OutputDebugString(SysErrorMessage(GetLastError()).c_str()); TerminateProcess(hAndle, 0); OutputDebugString(SysErrorMessage(GetLastError()).c_str()); } } while(Process32Next(hProcessSnap,&pe32)); } CloseHandle(hProcessSnap); } |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论