#ifdef UNICODE
#define A "W"
#else
#define A "A"
#endif
[Setup]
AppName=MainForm
AppVerName=MainForm 1.0
DefaultDirName={pf}\MainForm
// Нужно вырубить эту страницу т.к. там ставиться фокус на кнопку Next
DisableReadyPage=yes
OutputDir=.
[Code]
function GetForegroundWindow: HWND; external 'GetForegroundWindow@user32.dll stdcall delayload';
function SetForegroundWindow(hWnd: HWND): BOOL; external 'SetForegroundWindow@user32.dll stdcall delayload';
procedure MShow(Sender: TObject);
begin
MainForm.Show;
if GetForegroundWindow = WizardForm.Handle then
SetForegroundWindow(MainForm.Handle);
end;
procedure DirOnClick(Sender: TObject);
var
UserSelectDir: String;
begin
UserSelectDir:= WizardForm.DirEdit.Text;
if BrowseForFolder(SetupMessage(msgBrowseDialogLabel), UserSelectDir, True) then
WizardForm.DirEdit.Text:= UserSelectDir;
end;
procedure InitializeWizard();
var
r: TRect;
begin
with MainForm do
begin
Width:= WizardForm.Width;
Height:= WizardForm.Height;
BorderIcons := WizardForm.BorderIcons;
BorderStyle := WizardForm.BorderStyle;
Position:= poDesktopCenter;
with TBitmapImage.Create(MainForm) do
begin
Parent:= MainForm;
Width:= MainForm.ClientWidth;
Height:= MainForm.ClientHeight;
with Bitmap do begin
Width:= Width;
Height:= Height;
Canvas.Brush.Color:= clWindow;
r.Left:=0;
r.Top:=0;
r.Right:=WizardfOrm.ClientWidth;
r.Bottom:=WizardForm.ClientHeight;
Canvas.FillRect(r);
end;
end;
end;
WizardForm.Left:= -10000;
WizardForm.OnShow:= @MShow;
//
WizardForm.NextButton.Parent:= MainForm;
WizardForm.BackButton.Parent:= MainForm;
WizardForm.CancelButton.Parent:= MainForm;
WizardForm.OuterNotebook.Parent:= MainForm;
WizardForm.Bevel.Parent:= MainForm;
WizardForm.DirBrowseButton.OnClick:= @DirOnClick;
end;
function GetSystemMenu(hWnd: HWND; bRevert: BOOL): LongWord; external 'GetSystemMenu@user32.dll stdcall';
function EnableMenuItem(hMenu: THandle; uIDEnableItem: Longword; uEnable: Longword): Boolean; external 'EnableMenuItem@user32.dll stdcall';
const
MF_BYCOMMAND = 0;
MF_ENABLED = 0;
MF_GRAYED = 1;
MF_DISABLED = 2;
SC_CLOSE = 61536;
procedure CurPageChanged(CurPageID: Integer);
begin
if CurPageID=wpSelectDir then
WizardForm.NextButton.Caption:= SetupMessage(msgButtonInstall);
if CurPageID=wpFinished then
EnableMenuItem(GetSystemMenu(MainForm.Handle, false), SC_CLOSE, MF_DISABLED or MF_BYCOMMAND);
end;