c++ 根据进程ID结束进程

180it 2020-10-17 AM 1747℃ 0条
#include <iostream>
#include <windows.h>


void KillProcessById(DWORD pid) {
    HANDLE hnd;
    hnd = OpenProcess(SYNCHRONIZE | PROCESS_TERMINATE, TRUE, pid);
    TerminateProcess(hnd, 0);
}

int main() {
    using namespace std;
    DWORD pid = GetCurrentProcessId();
    KillProcessById(2644);

    cout<< "https://helloacm.com" <<endl;
    return 0;
}

支付宝打赏支付宝打赏 微信打赏微信打赏

如果文章或资源对您有帮助,欢迎打赏作者。一路走来,感谢有您!

标签: none

c++ 根据进程ID结束进程