PageRenderTime 28ms CodeModel.GetById 21ms app.highlight 2ms RepoModel.GetById 2ms app.codeStats 0ms

/NagScreen.pas

http://mytc.googlecode.com/
Pascal | 70 lines | 64 code | 6 blank | 0 comment | 7 complexity | b77071883e94861b37d274b154f6013e MD5 | raw file
 1unit NagScreen;
 2
 3interface
 4
 5uses
 6  Messages,
 7  Windows;
 8
 9procedure CloseNagScreen;
10
11implementation
12
13procedure CloseNagScreen;
14var
15  NastyNagScreen: HWND;
16  Notebook: HWND;
17  Page: HWND;
18  Panel: HWND;
19  NumPanel: HWND;
20  NumButton: HWND;
21  NumText: string;
22  RepeatCount: integer;
23begin
24  while True do
25  begin
26    NastyNagScreen := 0;
27    Notebook := 0;
28    Page := 0;
29    Panel := 0;
30    NumPanel := 0;
31    NumButton := 0;
32    NumText := '';
33    RepeatCount := 0;
34    while (NastyNagScreen = 0) do
35    begin
36      NastyNagScreen := FindWindow('TNASTYNAGSCREEN', nil);
37      Sleep(1);
38    end;
39    while (Notebook = 0) and (RepeatCount < 100) do
40    begin
41      Notebook := FindWindowEx(NastyNagScreen, 0, 'TNotebook', nil);
42      Inc(RepeatCount);
43    end;
44    while (Page = 0) and (RepeatCount < 100) do
45    begin
46      Page := FindWindowEx(Notebook, 0, 'TPage', nil);
47      Inc(RepeatCount);
48    end;
49    while (Panel = 0) and (RepeatCount < 100) do
50    begin
51      Panel := FindWindowEx(Page, 0, 'TPanel', nil);
52      Inc(RepeatCount);
53    end;
54    while (NumPanel = 0) and (RepeatCount < 100) do
55    begin
56      NumPanel := FindWindowEx(Panel, 0, 'TPanel', nil);
57      Inc(RepeatCount);
58    end;
59    while (NumButton = 0) and (RepeatCount < 100) do
60    begin
61      SetLength(NumText, SendMessage(NumPanel, WM_GETTEXTLENGTH, 0, 0));
62      SendMessage(NumPanel, WM_GETTEXT, Length(NumText) + 1, LPARAM(NumText));
63      NumButton := FindWindowEx(Panel, 0, 'TButton', PChar('&' + NumText));
64      Inc(RepeatCount);
65    end;
66    SendMessage(NumButton, BM_CLICK, 0, 0);
67  end;
68end;
69
70end.