Delphi 检测应用程序是否已停止响应


本文整理自网络,侵删。

 
procedure TForm2.Button1Click(Sender: TObject);
var
  H : THandle;
  lngReturnValue : longint;
  DWResult : DWORD;
begin
  H := FindWindow('Notepad', nil);
  if H > 0 then
  begin
    lngReturnValue := SendMessageTimeout(
      H, WM_NULL, 0, 0, SMTO_ABORTIFHUNG And SMTO_BLOCK,
      1000, DWResult
    );//delphitop.com
    if lngReturnValue > 0 then
      ShowMessage('响应')
    else
      ShowMessage('Not 响应');
  end
  else
    ShowMessage('Application not found');
end;

相关阅读 >>

Delphi中的各种文件类型介绍

Delphi几个进制相关的代码(hextoint、hextoasc)

Delphi tparallel.for 老外得示例代码

Delphi idhttpserver接收http get请求解码问题

Delphi通过解析搜狐网页来获取天气的函数

indy断点续传

Delphi 在长文件名和短文件名之间转换

Delphi memo中禁止汉字

如何使用Delphi 10 seattle的android应用做intent的发送和接收

Delphi中如何用一个按钮控制开与关两个状态

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...