本文整理自网络,侵删。
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获取dos命令行输出函数 运行cmd命令并获取结果
Delphi thread.queue与synchronize的区别
Delphi的webbrowser改造,对网页中alter等对话框的改造方法
Delphi winapi: getparent - 获取指定窗口的父窗口句柄
更多相关阅读请进入《Delphi》频道 >>