Delphi 如何识别应用程序没有响应
2023-01-03 09:13:14 作者:admin
本文整理自网络,侵删。
unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} function AppFrozen(H: HWND) : Boolean; var dwResult: DWord; const timeout = 3000; // ms begin AppFrozen := SendMessageTimeout(H, WM_NULL, 0, 0, SMTO_ABORTIFHUNG or SMTO_BLOCK, timeout, dwResult) <> 0 end; procedure TForm1.Button1Click(Sender: TObject); var H: HWND; begin H := FindWindow(nil, 'Name of Application'); if H<>0 then if AppFrozen(H) then ShowMessage('This Application is Frozen!'); end; end.
相关阅读 >>
Delphi 检查屏幕是否处于锁屏或关闭状态
Delphi 在tunimemo中复制和粘贴选定的文本
Delphi 字节数转换为kb或mb字符串
Delphi禁止webbrowser弹出窗口或者脚本错误
Delphi 把窗体客户区图像保存到文件或剪切板
Delphi xe tbitmap支持gif,成为具有jpg,gif,bmp,ico,gif五种显示功能的图片控件
Delphi 获取 access 数据库所有表
Delphi xe中使用tchart绘制平滑曲线
Delphi 暴力搜索api
Delphi xe 程序瘦身.编译后exe最低90kb
更多相关阅读请进入《Delphi》频道 >>
猜你喜欢
联络方式:
400-123-789
邮箱:xiachao@163.com
Q Q:12345678
微信公众号
微信二维码