innonewbie
Junior Member | Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору [Setup] AppId={{7846D49A-950D-43AD-9941-C7DD2762884C} AppName=My Program ;AppVersion=1.5 AppVerName=My Program DefaultDirName={pf}\My Program DefaultGroupName=My Program OutputBaseFilename=setup Compression=lzma SolidCompression=yes [Languages] Name: "english"; MessagesFile: "compiler:Default.isl" [Tasks] Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked [Files] Source: "C:\Program Files\Inno Setup 5\Examples\MyProg.exe"; DestDir: "{app}"; Flags: ignoreversion Source: Image2.bmp; DestDir: {tmp}; Flags: dontcopy nocompression Source: papka.bmp; DestDir: {tmp}; Flags: dontcopy nocompression Source: button.bmp; DestDir: {tmp}; Flags: dontcopy nocompression [Icons] Name: "{group}\My Program"; Filename: "{app}\MyProg.exe" Name: "{commondesktop}\My Program"; Filename: "{app}\MyProg.exe"; Tasks: desktopicon [Code] var Image2: TBitmapImage; WelcomeLabel1, WelcomeLabel2, FinishedLabel, FinishedHeadingLabel: TLabel; procedure InitializeWizard1(); var Page: TWizardPage; begin ExtractTemporaryFile('Image2.bmp') WizardForm.WizardBitmapImage.Width:=497 WizardForm.WelcomeLabel1.Visible:=true //false WizardForm.WelcomeLabel2.Visible:=true WizardForm.WizardBitmapImage2.Visible:=true WizardForm.FinishedLabel.Visible:=true WizardForm.FinishedHeadingLabel.Visible:=true // end; procedure CurPageChanged1(CurPageID: Integer); begin If CurPageID=wpFinished then begin Image2:=TBitmapImage.Create(WizardForm) with Image2 do begin Left:=0 Top:=0 Width:=497 Height:=313 Parent:=WizardForm.FinishedPage Bitmap.LoadFromFile(ExpandConstant('{tmp}')+'\Image2.bmp') end end end; const Color = clblack; procedure InitializeWizard2(); begin WizardForm.Font.Color:=clWhite; WizardForm.Color:=Color; WizardForm.WelcomePage.Color:=Color; WizardForm.InnerPage.Color:=Color; WizardForm.FinishedPage.Color:=Color; WizardForm.LicensePage.Color:=Color; WizardForm.PasswordPage.Color:=Color; WizardForm.InfoBeforePage.Color:=Color; WizardForm.UserInfoPage.Color:=Color; WizardForm.SelectDirPage.Color:=Color; WizardForm.SelectComponentsPage.Color:=Color; WizardForm.SelectProgramGroupPage.Color:=Color; WizardForm.SelectTasksPage.Color:=Color; WizardForm.ReadyPage.Color:=Color; WizardForm.PreparingPage.Color:=Color; WizardForm.InstallingPage.Color:=Color; WizardForm.InfoAfterPage.Color:=Color; WizardForm.DirEdit.Color:=Color; WizardForm.DiskSpaceLabel.Color:=Color; WizardForm.DirEdit.Color:=Color; WizardForm.GroupEdit.Color:=Color; WizardForm.PasswordLabel.Color:=Color; WizardForm.PasswordEdit.Color:=Color; WizardForm.PasswordEditLabel.Color:=Color; WizardForm.ReadyMemo.Color:=Color; WizardForm.TypesCombo.Color:=Color; WizardForm.WelcomeLabel1.Color:=Color; WizardForm.WelcomeLabel1.Font.Color:=clWhite; WizardForm.InfoBeforeClickLabel.Color:=Color; WizardForm.MainPanel.Color:=Color; WizardForm.PageNameLabel.Color:=Color; WizardForm.PageDescriptionLabel.Color:=Color; WizardForm.ReadyLabel.Color:=Color; WizardForm.FinishedLabel.Color:=Color; WizardForm.YesRadio.Color:=Color; WizardForm.NoRadio.Color:=Color; WizardForm.WelcomeLabel2.Color:=Color; WizardForm.LicenseLabel1.Color:=Color; WizardForm.InfoAfterClickLabel.Color:=Color; WizardForm.ComponentsList.Color:=Color; WizardForm.ComponentsDiskSpaceLabel.Color:=Color; WizardForm.BeveledLabel.Color:=Color; WizardForm.StatusLabel.Color:=Color; WizardForm.FilenameLabel.Color:=Color; WizardForm.SelectDirLabel.Color:=Color; WizardForm.SelectStartMenuFolderLabel.Color:=Color; WizardForm.SelectComponentsLabel.Color:=Color; WizardForm.SelectTasksLabel.Color:=Color; WizardForm.LicenseAcceptedRadio.Color:=Color; WizardForm.LicenseNotAcceptedRadio.Color:=Color; WizardForm.UserInfoNameLabel.Color:=Color; WizardForm.UserInfoNameEdit.Color:=Color; WizardForm.UserInfoOrgLabel.Color:=Color; WizardForm.UserInfoOrgEdit.Color:=Color; WizardForm.PreparingLabel.Color:=Color; WizardForm.FinishedHeadingLabel.Color:=Color; WizardForm.FinishedHeadingLabel.Font.Color:=clWhite; WizardForm.UserInfoSerialLabel.Color:=Color; WizardForm.UserInfoSerialEdit.Color:=Color; WizardForm.TasksList.Color:=Color; WizardForm.RunList.Color:=Color; WizardForm.SelectDirBrowseLabel.Color:=Color; WizardForm.SelectStartMenuFolderBrowseLabel.Color:=Color; WizardForm.PageNameLabel.Font.Color:=clWhite; end; procedure InitializeWizard3(); begin with WizardForm do begin with MainPanel do Height := Height - 1; with WizardSmallBitmapImage do begin Left := 0; Top := 0; Height := 58; //Размер рисунка Width := 497; // end; with PageNameLabel do begin Width := Width - 497; //Поставьте здесь значения на 0, если хотите вернуть текст Left := Left + 497; // end; with PageDescriptionLabel do begin Width := Width - 497; //Поставьте здесь значения на 0, если хотите вернуть текст Left := Left + 497; // end; end; end; procedure InitializeWizard4(); begin ExtractTemporaryFile('papka.bmp'); WizardForm.SelectDirBitmapImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\papka.bmp')); WizardForm.SelectDirBitmapImage.AutoSize:=true; WizardForm.SelectGroupBitmapImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\papka.bmp')); WizardForm.SelectGroupBitmapImage.AutoSize:=true; end; const NeedSize = 20; DRIVE_UNKNOWN = 0; DRIVE_NO_ROOT_DIR = 1; DRIVE_REMOVEABLE = 2; DRIVE_FIXED = 3; DRIVE_REMOTE = 4; DRIVE_CDROM = 5; DRIVE_RAMDISK = 6; var ListBox: TListBox; Text: TNewStaticText; function GetLogicalDrives: DWORD; external 'GetLogicalDrives@kernel32.dll stdcall'; function GetDriveType(nDrive: string): Longint; external 'GetDriveTypeA@kernel32.dll stdcall'; procedure ListBoxOnClick(Sender: TObject); var NewLetter, OldString: string; i: Integer; begin for i := 0 to ListBox.Items.Count - 1 do begin if ListBox.Selected[i] then begin NewLetter := Copy(ListBox.Items[i], 0, 1); OldString := Copy(WizardForm.DirEdit.Text, 2, Length(WizardForm.DirEdit.Text)); WizardForm.DirEdit.Text := NewLetter + OldString; end; end; end; procedure InitializeWizard5(); var Path: string; FreeMB, TotalMB: Cardinal; drives: DWORD; i: integer; begin Text := TNewStaticText.Create(WizardForm); Text.Top := 100; Text.Width := 332; Text.Height := 14; Text.Caption := 'Список жестких дисков и свободного места'; Text.Parent := WizardForm.SelectDirPage; ListBox := TListBox.Create(WizardForm); ListBox.Top := 120; ListBox.Width := 332; ListBox.Height := ScaleY(90); ListBox.Parent := WizardForm.SelectDirPage; ListBox.OnClick := @ListBoxOnClick; ListBox.Font.Style := [fsBold]; ListBox.Font.Name := 'Arial'; ListBox.Color := clBlack; drives := GetLogicalDrives(); for i := 0 to 31 do begin if (drives and (1 shl i)) > 0 then begin Path := chr(ord('A') + i) + ':'; if GetDriveType(Path) = DRIVE_FIXED then begin GetSpaceOnDisk(Path, True, FreeMB, TotalMB); ListBox.Items.Add(Path + ' - Всего: ' + IntToStr(TotalMB) + 'Мб - Свободно: ' + IntToStr(FreeMB) + 'Мб'); end; end; end; end; function NextButtonClick(CurPageID: Integer): Boolean; var Path: string; FreeMB, TotalMB: Cardinal; begin Result := True; if CurPageID = wpSelectDir then begin Path := ExtractFileDrive(WizardForm.DirEdit.Text); GetSpaceOnDisk(Path, True, FreeMB, TotalMB); if FreeMB < NeedSize then begin MsgBox('Недостаточно места на диске!', mbInformation, MB_OK) Result := False; end; end; end; const ButtonWidth = 80; ButtonHeight = 23; bidBack = 0; bidNext = 1; bidCancel = 2; bidDirBrowse = 3; bidGroupBrowse = 4; var ButtonPanel: array [0..4] of TPanel; ButtonImage: array [0..4] of TBitmapImage; ButtonLabel: array [0..4] of TLabel; procedure ButtonLabelClick(Sender: TObject); var Button: TButton; begin ButtonImage[TLabel(Sender).Tag].Left:=0 case TLabel(Sender).Tag of bidBack: Button:=WizardForm.BackButton; bidNext: Button:=WizardForm.NextButton; bidCancel: Button:=WizardForm.CancelButton; bidDirBrowse: Button:=WizardForm.DirBrowseButton; bidGroupBrowse: Button:=WizardForm.GroupBrowseButton; else Exit end Button.OnClick(Button) end; procedure ButtonLabelMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin if ButtonLabel[TLabel(Sender).Tag].Enabled then ButtonImage[TLabel(Sender).Tag].Left:=-ButtonWidth end; procedure ButtonLabelMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin ButtonImage[TLabel(Sender).Tag].Left:=0 end; procedure LoadButtonImage(AButton: TButton; AButtonIndex: integer); var Image: TBitmapImage; Panel: TPanel; Labl: TLabel; begin Panel:=TPanel.Create(WizardForm) Panel.Left:=AButton.Left Panel.Top:=AButton.Top Panel.Width:=AButton.Width Panel.Height:=AButton.Height Panel.Tag:=AButtonIndex Panel.Parent:=AButton.Parent ButtonPanel[AButtonIndex]:=Panel Image:=TBitmapImage.Create(WizardForm) Image.Width:=160 Image.Height:=23 Image.Enabled:=False Image.Bitmap.LoadFromFile(ExpandConstant('{tmp}\button.bmp')) Image.Parent:=Panel ButtonImage[AButtonIndex]:=Image with TLabel.Create(WizardForm) do begin Tag:=AButtonIndex Parent:=Panel Width:=Panel.Width Height:=Panel.Height Transparent:=True OnClick:=@ButtonLabelClick OnDblClick:=@ButtonLabelClick OnMouseDown:=@ButtonLabelMouseDown OnMouseUp:=@ButtonLabelMouseUp end; Labl:=TLabel.Create(WizardForm) Labl.Left:=15 // двигать надпись на кнопке если съезжает Labl.Top:=5 Labl.Autosize:=True Labl.Alignment:=taCenter// taRightJustify (если съезжают надписи на кнопке) Labl.Tag:=AButtonIndex Labl.Transparent:=true Labl.Font.Color:=clwhite // цвет текста на кнопках Labl.Caption:=AButton.Caption Labl.OnClick:=@ButtonLabelClick Labl.OnDblClick:=@ButtonLabelClick Labl.OnMouseDown:=@ButtonLabelMouseDown Labl.OnMouseUp:=@ButtonLabelMouseUp Labl.Parent:=Panel ButtonLabel[AButtonIndex]:=Labl end; procedure UpdateButton(AButton: TButton;AButtonIndex: integer); begin ButtonLabel[AButtonIndex].Caption:=AButton.Caption ButtonPanel[AButtonIndex].Visible:=AButton.Visible ButtonLabel[AButtonIndex].Enabled:=Abutton.Enabled end; procedure LicenceAcceptedRadioOnClick(Sender: TObject); begin ButtonLabel[bidNext].Enabled:=True end; procedure LicenceNotAcceptedRadioOnClick(Sender: TObject); begin ButtonLabel[bidNext].Enabled:=False end; procedure InitializeWizard6(); begin WizardForm.BackButton.Width:=ButtonWidth WizardForm.BackButton.Height:=ButtonHeight WizardForm.NextButton.Width:=ButtonWidth WizardForm.NextButton.Height:=ButtonHeight WizardForm.CancelButton.Width:=ButtonWidth WizardForm.CancelButton.Height:=ButtonHeight WizardForm.DirBrowseButton.Left:=337 WizardForm.DirBrowseButton.Width:=ButtonWidth WizardForm.DirBrowseButton.Height:=ButtonHeight WizardForm.GroupBrowseButton.Left:=337 WizardForm.GroupBrowseButton.Width:=ButtonWidth WizardForm.GroupBrowseButton.Height:=ButtonHeight WizardForm.LicenseAcceptedRadio.OnClick:=@LicenceAcceptedRadioOnClick WizardForm.LicenseNotAcceptedRadio.OnClick:=@LicenceNotAcceptedRadioOnClick ExtractTemporaryFile('button.bmp') LoadButtonImage(WizardForm.BackButton,bidBack) LoadButtonImage(WizardForm.NextButton,bidNext) LoadButtonImage(WizardForm.CancelButton,bidCancel) LoadButtonImage(WizardForm.DirBrowseButton,bidDirBrowse) LoadButtonImage(WizardForm.GroupBrowseButton,bidGroupBrowse) end; procedure InitializeWizard7(); begin ExtractTemporaryFile('image2.bmp'); WizardForm.WizardBitmapImage.Width:= ScaleX(497); WizardForm.WizardBitmapImage2.Width:= ScaleX(497); WizardForm.WizardBitmapImage2.Bitmap.LoadFromFile(ExpandConstant('{tmp}\image2.bmp')); WelcomeLabel1:= TLabel.Create(WizardForm); WelcomeLabel1.AutoSize:= False; with WizardForm.WelcomeLabel1 do WelcomeLabel1.SetBounds(Left, Top, Width, Height); WelcomeLabel1.Font:= WizardForm.WelcomeLabel1.Font WelcomeLabel1.Font.Color:= clWhite; WelcomeLabel1.Transparent:= True; WelcomeLabel1.WordWrap:= true; WelcomeLabel1.Caption:= WizardForm.WelcomeLabel1.Caption; WelcomeLabel1.Parent:= WizardForm.WelcomePage WelcomeLabel2:= TLabel.Create(WizardForm); WelcomeLabel2.AutoSize:= False; with WizardForm.WelcomeLabel2 do WelcomeLabel2.SetBounds(Left, Top, Width, Height); WelcomeLabel2.Font:= WizardForm.WelcomeLabel2.Font WelcomeLabel2.Font.Color:= clWhite; WelcomeLabel2.Transparent:= True; WelcomeLabel2.WordWrap:= true; WelcomeLabel2.Caption:= WizardForm.WelcomeLabel2.Caption; WelcomeLabel2.Parent:= WizardForm.WelcomePage FinishedHeadingLabel:= TLabel.Create(WizardForm); FinishedHeadingLabel.AutoSize:= False; with WizardForm.FinishedHeadingLabel do FinishedHeadingLabel.SetBounds(Left, Top, Width, Height); FinishedHeadingLabel.Font:= WizardForm.FinishedHeadingLabel.Font FinishedHeadingLabel.Font.Color:= clWhite; FinishedHeadingLabel.Transparent:= True; FinishedHeadingLabel.WordWrap:= true; FinishedHeadingLabel.Caption:= WizardForm.FinishedHeadingLabel.Caption; FinishedHeadingLabel.Parent:= WizardForm.FinishedPage FinishedLabel:= TLabel.Create(WizardForm); FinishedLabel.AutoSize:= False; with WizardForm.FinishedLabel do FinishedLabel.SetBounds(Left, Top, Width, Height); FinishedLabel.Font:= WizardForm.FinishedLabel.Font FinishedLabel.Font.Color:= clWhite; FinishedLabel.Transparent:= True; FinishedLabel.WordWrap:= true; FinishedLabel.Caption:= WizardForm.FinishedLabel.Caption; FinishedLabel.Parent:= WizardForm.FinishedPage WizardForm.WelcomeLabel1.Hide; WizardForm.WelcomeLabel2.Hide; WizardForm.FinishedLabel.Hide; WizardForm.FinishedHeadingLabel.Hide; end; procedure CurPageChanged(CurPageID: Integer); begin UpdateButton(WizardForm.BackButton,bidBack) UpdateButton(WizardForm.NextButton,bidNext) UpdateButton(WizardForm.CancelButton,bidCancel) if CurPageID = wpSelectDir then begin WizardForm.NextButton.Enabled := true; ButtonLabel[bidNext].Enabled := true; ButtonPanel[bidNext].Enabled := true; FinishedLabel.Caption:= WizardForm.FinishedLabel.Caption; end; end; procedure InitializeWizard(); begin InitializeWizard1(); InitializeWizard2(); InitializeWizard3(); InitializeWizard4(); InitializeWizard5(); InitializeWizard6(); InitializeWizard7(); end; | Всего записей: 168 | Зарегистр. 30-12-2010 | Отправлено: 16:50 23-01-2011 | Исправлено: innonewbie, 17:18 23-01-2011 |
|