杀死进程的API使用 TerminateProcess绝对可以。发送消息时,程序可能会拦截消息,不让程序退出。但是TerminateProcess是强制终止,所以绝对可以。Win2000的任务管理器使用的应该就是TerminateProcess。

DWORD dwProcID;

HANDLE hProcess;

HWND h = FindWindow(0, "未定标题 - 记事本");

if (h==NULL)

{

ShowMessage("Not found.");

return;

}

GetWindowThreadProcessId(h, &dwProcID);

hProcess = OpenProcess(PROCESS_ALL_ACCESS,0, dwProcID);

TerminateProcess(hProcess, 0);

相关文章:

  • 2021-12-22
  • 2021-06-20
  • 2022-12-23
  • 2022-12-23
  • 2021-12-05
  • 2021-11-16
  • 2021-11-27
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-04
  • 2021-11-16
  • 2021-06-30
  • 2022-12-23
相关资源
相似解决方案