var
tmr: TTimer;
i: integer;
ext: boolean;
wnd, btn : HWND;
const
WM_CLOSE = $0010;
WM_SETTEXT = $C;
function SendMessageW(hWnd: HWND; Msg: UINT; wParam: Longint; lParam: Pansichar): Longint; external 'SendMessageA@user32.dll stdcall';
function GetDlgItem(hWnd: hWnd; nIDDlgItem: integer): HWND; external 'GetDlgItem@user32.dll stdcall';
procedure Timer(Sender: TObject);
begin
i:= i - 1;
if (wnd = 0) then
begin
wnd := FindWindowByWindowName(SetupMessage(msgSetupAppTitle));
tmr.Interval:= 1000;
end;
if (btn = 0) and (wnd <> 0) then
btn := GetDlgItem(wnd, 2);
if (btn <> 0) then
SendMessageW(btn, WM_SETTEXT, 0, SetupMessage(msgButtonOK) + ' ' + IntToStr(i));
if (i = 0) then
begin
if (ext = true) and (wnd <> 0) then
SendMessage(wnd, WM_CLOSE, 0, 0);
tmr.Enabled := false;
end;
end;
procedure MsgBoxTimeOut(const Text: string; WaitSeconds: integer; AutoClose: boolean);
begin
i := WaitSeconds + 1;
ext := AutoClose;
tmr := TTimer.Create(nil);
with tmr do
begin
Interval := 1;
OnTimer := @Timer;
end;
MsgBox(Text, mbInformation, MB_OK);
wnd:= 0;
btn:= 0;
tmr.Free;
end;
procedure InitializeWizard;
begin
MsgBoxTimeOut('Текст', 3, true);
end;