1
2 unit Unit1;
3
4 interface
5
6 uses
7 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
8 Dialogs, StdCtrls;
9
10 type
11 TForm1 = class(TForm)
12 Button1: TButton;
13 procedure Button1Click(Sender: TObject);
14 private
15 { Private declarations }
16 public
17 { Public declarations }
18 end;
19
20 var
21 Form1: TForm1;
22
23 implementation
24
25 {$R *.dfm}
26
27 function AppFrozen(H: HWND) : Boolean;
28 var
29 dwResult: DWord;
30 const
31 timeout = 3000; // ms
32 begin
33 AppFrozen := SendMessageTimeout(H, WM_NULL, 0, 0,
34 SMTO_ABORTIFHUNG or SMTO_BLOCK,
35 timeout, dwResult) <> 0
36 end;
37
38
39
40 procedure TForm1.Button1Click(Sender: TObject);
41 var
42 H: HWND;
43
44 begin
45
46 H := FindWindow(nil, 'Name of Application');
47 if H<>0 then
48 if AppFrozen(H) then
49 ShowMessage('This Application is Frozen!');
50
51
52 end;
53
54 end.
55
|