[Setup] AppName=My Program AppVerName=My Program version 1.5 DefaultDirName={pf}\My Program DefaultGroupName=My Program Compression=lzma SolidCompression=yes [Files] Source: "MyProg.exe"; DestDir: "{app}" [Code] type TMsg = record hwnd: HWnd; msg: Word; wParam: Word; lParam: Word; time: Longint; pt: TPoint; end; var CancelBtn: TButton; Msg: TMsg; function PeekMessage(var Msg: TMsg; Wnd: HWnd; MsgFilterMin, MsgFilterMax, wRemoveMsg: LongInt): LongInt; external 'PeekMessageW@user32.dll stdcall'; procedure ProcessMessage(); begin MsgBox('hello', mbInformation, MB_OK); end; procedure InitializeWizard(); var Form: TSetupForm; ProgressBar: TNewProgressBar; i: integer; Wnd: HWND; res: LongInt; begin Form := CreateCustomForm(); try with Form do begin ClientWidth := ScaleX(380); ClientHeight := ScaleY(120); BorderStyle:= bsDialog; Center; end; CancelBtn := TButton.Create(Form); with CancelBtn do begin Width := ScaleX(75); Height := ScaleY(23); Left := Form.ClientWidth - ScaleX(75 + 10); Top := Form.ClientHeight - ScaleY(23 + 10); Parent := Form; Caption := 'Îòìåíà'; end; ProgressBar := TNewProgressBar.Create(Form); with ProgressBar do begin Height := CancelBtn.Height - ScaleY(8); Width := Form.Width - ScaleX(128); Top := ScaleX(10); Left := ScaleY(10); Parent := Form; Min:= 0; Max:= 1000; Position := 0; end; Form.ActiveControl := CancelBtn; Form.Show(); for i:= 0 to 1000 do begin res:= PeekMessage(Msg, CancelBtn.Handle, $0202, $0202, 1); if res <> 0 then begin ProcessMessage(); end; ProgressBar.Position:= ProgressBar.Position + 1; Form.Refresh; Sleep(5); end; finally Form.Free(); end; end; |