2024年3月25日发(作者:)

// : Defines the entry point for the console application.

//

#include "stdafx.h"

#include

#include

#include

#include

int KillProcess(DWORD Pid)

{

//打开进程得到进程句柄

HANDLE hProcess=OpenProcess(PROCESS_ALL_ACCESS,FALSE,Pid);

if(hProcess==NULL)

{

printf("OpenProcess errorn");

return 0;

}

//结束进程

if (TerminateProcess(hProcess,0))

{

printf("结束进程成功n");

return 0;

}

else

{

printf("结束进程失败n");

return 0;