Имя пользователя:
Пароль:  
Помощь | Регистрация | Забыли пароль?  

Показать сообщение отдельно

Аватара для STRELOK

Новый участник


Сообщения: 13
Благодарности: 1

Профиль | Отправить PM | Цитировать


так народ.
Как мне в этом скрипте
читать дальше »

Код: Выделить весь код
[Setup]
AppName=Dirt 2
AppVerName=Dirt 2
DefaultDirName={pf}\Dirt 2
DefaultGroupName=Dirt 2
OutputDir=userdocs:Dirt 2 Setup.

[Languages]
Name: rus; MessagesFile: "compiler:Languages\Russian.isl";

[Files]
Source: "bitmap\WizardImageFile.bmp"; Flags: dontcopy nocompression;
Source: "bitmap\button.bmp"; Flags: dontcopy nocompression;
Source: "support\GameuxInstallHelper.dll"; DestDir: "{app}"; Flags: ignoreversion uninsremovereadonly overwritereadonly;
Source: "src\dirt2.exe"; DestDir: "{app}"; Flags: ignoreversion;
; Test
;Source: "{sys}\*.dll"; DestDir: "{tmp}"; Flags: external;

[Icons]
Name: "{commondesktop}\Dirt 2"; Filename: "{app}\dirt2.exe"; WorkingDir: "{app}"; OnlyBeLowVersion: "0,6.0";
Name: "{group}\Dirt 2"; Filename: "{app}\dirt2.exe"; WorkingDir: "{app}"; OnlyBeLowVersion: "0,6.0";
Name: "{group}\Удалить Dirt 2"; Filename: "{uninstallexe}"; OnlyBeLowVersion: "0,6.0";

[_Code]
const
  ButtonWidth = 103;
  ButtonHeight = 32;
  PlayTask = 0;
  bidBack = 0;
  bidNext = 1;
  bidCancel = 2;
  bidDirBrowse = 3;
  bidGroupBrowse = 4;

function GenerateGUID(var pGuid: TGuid): Longword;
 external 'GenerateGUID@files:GameuxInstallHelper.dll stdcall setuponly';
function AddToGameExplorer(gdf: String; InstallPath: String; InstallType: Integer; var pGuid: TGuid): Longword;
 external 'AddToGameExplorerW@files:GameuxInstallHelper.dll stdcall setuponly';
function CreateTask(InstallType: Integer; var pGuid: TGuid; TaskType: Integer; TaskNumber: Integer; TaskName: String; ExecPath: String; Parameters: String): Longword;
 external 'CreateTaskW@files:GameuxInstallHelper.dll stdcall setuponly';
function RetrieveGUIDForApplication(gdf: String; var pGuid: TGuid): Longword;
 external 'RetrieveGUIDForApplicationW@{app}\GameuxInstallHelper.dll stdcall uninstallonly';
function RemoveFromGameExplorer(var pGuid: TGuid): Longword;
 external 'RemoveFromGameExplorer@{app}\GameuxInstallHelper.dll stdcall uninstallonly';
function RemoveTasks(var pGuid: TGuid): Longword;
 external 'RemoveTasks@{app}\GameuxInstallHelper.dll stdcall uninstallonly';

var
  pGuid: TGuid;
  SelDir, SelGroup, InstStutus, PageNameLabel: TLabel;
  ButtonPanel: array [0..4] of TPanel;
  ButtonImage: array [0..4] of TBitmapImage;
  ButtonLabel: array [0..4] of TLabel;

procedure DirChange(Sender: TObject);
begin
  SelDir.Caption := WizardForm.DirEdit.Text;
end;

procedure GroupChange(Sender: TObject);
begin
  SelGroup.Caption := WizardForm.GroupEdit.Text;
end;

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 := -ScaleX(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 := ScaleX(206);
  Image.Height := ScaleY(32);
  Image.Enabled := False;
  Image.Bitmap.LoadFromFile(ExpandConstant('{tmp}\button.bmp'));
  Image.Stretch := True;
  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 := ScaleX(23);
  Labl.Top := ScaleY(5);
  Labl.Autosize := True;
  Labl.Alignment := taCenter;
  Labl.Tag := AButtonIndex;
  Labl.Transparent := True;
  Labl.Font.Color := clBlack;
  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 InitializeWizard();
var
  GrBtnCapt, GrBtnCapt1: TLabel;
  NewBevel1, NewBevel1_1, NewBevel2, NewBevel2_2, NewBevel3,
  NewBevel3_3, NewBevel4, NewBevel4_4, NewBevel5, NewBevel5_5: TBevel;
begin
  ExtractTemporaryFile('WizardImageFile.bmp');
  ExtractTemporaryFile('button.bmp');

  NewBevel1 := TBevel.Create(WizardForm);
  NewBevel1.SetBounds(ScaleX(5), ScaleY(240), ScaleX(10), ScaleY(2));
  NewBevel1.Shape := bsTopLine;
  NewBevel1.Parent := WizardForm.SelectDirPage;

  GrBtnCapt := TLabel.Create(WizardForm);
  GrBtnCapt.Left := NewBevel1.Left + NewBevel1.Width + ScaleX(3);
  GrBtnCapt.Top := NewBevel1.Top - ScaleY(6);
  GrBtnCapt.Caption := ' Папка назначения ';
  GrBtnCapt.Transparent := True;
  GrBtnCapt.Parent := WizardForm.SelectDirPage;

  NewBevel3 := TBevel.Create(WizardForm);
  NewBevel3.SetBounds(NewBevel1.Left, NewBevel1.Top + ScaleY(40), ScaleX(440), ScaleY(2));
  NewBevel3.Shape := bsTopLine;
  NewBevel3.Parent := WizardForm.SelectDirPage;

  NewBevel2 := TBevel.Create(WizardForm);
  NewBevel2.SetBounds(GrBtnCapt.Left + GrBtnCapt.Width + ScaleX(3), ScaleY(240),
                  NewBevel3.Width - (NewBevel1.Left + NewBevel1.Width) -
                     (GrBtnCapt.Left + GrBtnCapt.Width) + ScaleX(16), ScaleY(2));
  NewBevel2.Shape := bsTopLine;
  NewBevel2.Parent := WizardForm.SelectDirPage;

  NewBevel4 := TBevel.Create(WizardForm);
  NewBevel4.SetBounds(NewBevel1.Left, NewBevel1.Top, ScaleX(2), ScaleY(40));
  NewBevel4.Shape := bsLeftLine;
  NewBevel4.Parent := WizardForm.SelectDirPage;

  NewBevel5 := TBevel.Create(WizardForm);
  NewBevel5.SetBounds(NewBevel3.Left + NewBevel3.Width - ScaleX(2), NewBevel1.Top, ScaleX(2), ScaleY(40));
  NewBevel5.Shape := bsLeftLine;
  NewBevel5.Parent := WizardForm.SelectDirPage;

  SelDir := TLabel.Create(WizardForm);
  SelDir.Left := NewBevel1.Left + ScaleX(5);
  SelDir.Top := NewBevel1.Top + ScaleY(21) - SelDir.Height div 2;
  SelDir.Caption := WizardForm.DirEdit.Text;
  SelDir.Parent := WizardForm.SelectDirPage;

  NewBevel1_1 := TBevel.Create(WizardForm);
  NewBevel1_1.SetBounds(ScaleX(5), ScaleY(240), ScaleX(10), ScaleY(2));
  NewBevel1_1.Shape := bsTopLine;
  NewBevel1_1.Parent := WizardForm.SelectProgramGroupPage;

  GrBtnCapt1 := TLabel.Create(WizardForm);
  GrBtnCapt1.Left := NewBevel1_1.Left + NewBevel1_1.Width + ScaleX(3);
  GrBtnCapt1.Top := NewBevel1_1.Top - ScaleY(6);
  GrBtnCapt1.Caption := ' Папка в меню Пуск ';
  GrBtnCapt1.Transparent := True;
  GrBtnCapt1.Parent := WizardForm.SelectProgramGroupPage;

  NewBevel3_3 := TBevel.Create(WizardForm);
  NewBevel3_3.SetBounds(NewBevel1_1.Left, NewBevel1_1.Top + ScaleY(40), ScaleX(440), ScaleY(2));
  NewBevel3_3.Shape := bsTopLine;
  NewBevel3_3.Parent := WizardForm.SelectProgramGroupPage;

  NewBevel2_2 := TBevel.Create(WizardForm);
  NewBevel2_2.SetBounds(GrBtnCapt1.Left + GrBtnCapt1.Width + ScaleX(3), ScaleY(240),
                  NewBevel3_3.Width - (NewBevel1_1.Left + NewBevel1_1.Width) -
                     (GrBtnCapt1.Left + GrBtnCapt1.Width) + ScaleX(16), ScaleY(2));
  NewBevel2_2.Shape := bsTopLine;
  NewBevel2_2.Parent := WizardForm.SelectProgramGroupPage;

  NewBevel4_4 := TBevel.Create(WizardForm);
  NewBevel4_4.SetBounds(NewBevel1_1.Left, NewBevel1_1.Top, ScaleX(2), ScaleY(40));
  NewBevel4_4.Shape := bsLeftLine;
  NewBevel4_4.Parent := WizardForm.SelectProgramGroupPage;

  NewBevel5_5 := TBevel.Create(WizardForm);
  NewBevel5_5.SetBounds(NewBevel3_3.Left + NewBevel3_3.Width - ScaleX(2), NewBevel1_1.Top, ScaleX(2), ScaleY(40));
  NewBevel5_5.Shape := bsLeftLine;
  NewBevel5_5.Parent := WizardForm.SelectProgramGroupPage;

  SelGroup := TLabel.Create(WizardForm);
  SelGroup.Left := NewBevel1_1.Left + ScaleX(5);
  SelGroup.Top := NewBevel1_1.Top + ScaleY(21) - SelDir.Height div 2;
  SelGroup.Caption := WizardForm.GroupEdit.Text;
  SelGroup.Parent := WizardForm.SelectProgramGroupPage;

  with WizardForm do
  begin
    ClientWidth := ScaleX(690);
    ClientHeight := ScaleY(496);
    Center;
    Bevel.Hide;
    Bevel1.Hide;
    MainPanel.Hide;
    WizardSmallBitmapImage.Hide;
    WizardBitmapImage2.Hide;
    BeveledLabel.Hide;
    OuterNotebook.SetBounds(ScaleX(220), ScaleY(90), ScaleX(450), ScaleY(340));
    InnerNotebook.SetBounds(0, 0, ScaleX(460), ScaleY(354));
    WizardBitmapImage.SetBounds(0, 0, ScaleX(690), ScaleY(496));
    WizardBitmapImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\WizardImageFile.bmp'));
    WizardBitmapImage.Parent := WizardForm;
    BackButton.SetBounds(WizardForm.BackButton.Left + ScaleX(55), ScaleY(459), ScaleX(103), ScaleY(32));
    NextButton.SetBounds(WizardForm.NextButton.Left + ScaleX(95), ScaleY(459), ScaleX(103), ScaleY(32));
    CancelButton.SetBounds(WizardForm.CancelButton.Left + ScaleX(162), ScaleY(459), ScaleX(103), ScaleY(32));
    WelcomePage.Color := clWhite;
    WelcomeLabel1.Left := ScaleX(10);
    WelcomeLabel1.Width := WizardForm.InnerNotebook.Width - ScaleX(20);
    WelcomeLabel2.Left := ScaleX(10);
    WelcomeLabel2.Width := WizardForm.InnerNotebook.Width - ScaleX(20);
    SelectDirPage.Color := clWhite;
    DirEdit.Hide;
    DirEdit.OnChange := @DirChange;
    SelectDirBitmapImage.Hide;
    DiskSpaceLabel.Left := ScaleX(10);
    DiskSpaceLabel.Top := ScaleY(320);
    DirBrowseButton.Left := NewBevel3.Width - ScaleX(103);
    DirBrowseButton.Top := NewBevel1.Top + ScaleY(21) - ScaleY(16);
    DirBrowseButton.Width := ScaleX(103);
    DirBrowseButton.Height := ScaleY(32);
    SelectDirLabel.Hide;
    SelectDirBrowseLabel.Left := ScaleX(10);
    SelectDirBrowseLabel.Top := SelectDirLabel.Top;
    SelectProgramGroupPage.Color := clWhite;
    SelectStartMenuFolderLabel.Hide;
    SelectStartMenuFolderBrowseLabel.Left := ScaleX(10);
    SelectStartMenuFolderBrowseLabel.Top := SelectStartMenuFolderLabel.Top;
    SelectGroupBitmapImage.Hide;
    GroupEdit.Hide;
    GroupEdit.OnChange := @GroupChange;
    NoIconsCheck.Hide;
    GroupBrowseButton.Left := NewBevel3_3.Width - ScaleX(103);
    GroupBrowseButton.Top := NewBevel1_1.Top + ScaleY(21) - ScaleY(16);
    GroupBrowseButton.Width := ScaleX(103);
    GroupBrowseButton.Height := ScaleY(32);
    ReadyPage.Color := clWhite;
    ReadyLabel.Left := ScaleX(10);
    ReadyLabel.Top := ReadyLabel.Top + ScaleY(10);
    ReadyMemo.Left := ScaleX(10);
    ReadyMemo.Top := ReadyMemo.Top + ScaleY(10);
    ReadyMemo.Width := InnerNotebook.Width - ScaleX(30);
    ReadyMemo.Height := ReadyMemo.Height + ScaleY(90);
    ReadyMemo.Color := clWhite;
    InstallingPage.Color := clWhite;
    ProgressGauge.Left := ScaleX(10);
    ProgressGauge.Top := NewBevel3.Top + NewBevel3.Height div 2 - ProgressGauge.Height div 2;
    ProgressGauge.Width := InnerNotebook.Width - ScaleX(30);
    StatusLabel.Left := ScaleX(10);
    StatusLabel.Top := ProgressGauge.Top - ScaleY(3) - FilenameLabel.Height - StatusLabel.Height;
    FilenameLabel.Left := ScaleX(10);
    FilenameLabel.Top := ProgressGauge.Top - ScaleY(3) - FilenameLabel.Height;
    FinishedPage.Color := clWhite;
    FinishedHeadingLabel.Left := ScaleX(10);
    FinishedHeadingLabel.Width := WizardForm.InnerNotebook.Width - ScaleX(20);
    FinishedLabel.Left := ScaleX(10);
    FinishedLabel.Width := WizardForm.InnerNotebook.Width - ScaleX(20);
    RunList.Hide;
    NoRadio.Hide;
    YesRadio.Hide;
  end;

  PageNameLabel := TLabel.Create(WizardForm);
  PageNameLabel.SetBounds(ScaleX(24), ScaleY(10), ScaleX(405), ScaleY(14));
  PageNameLabel.AutoSize := False;
  PageNameLabel.WordWrap := True;
  PageNameLabel.Font.Style := [fsBold];
  PageNameLabel.ShowAccelChar := False;
  PageNameLabel.Parent := WizardForm;

  InstStutus := TLabel.Create(WizardForm);
  InstStutus.Left := ScaleX(10);
  InstStutus.Top := WizardForm.SelectDirLabel.Top;
  InstStutus.Parent := WizardForm.InstallingPage;

  LoadButtonImage(WizardForm.BackButton,bidBack);
  LoadButtonImage(WizardForm.NextButton,bidNext);
  LoadButtonImage(WizardForm.CancelButton,bidCancel);
  LoadButtonImage(WizardForm.DirBrowseButton,bidDirBrowse);
  LoadButtonImage(WizardForm.GroupBrowseButton,bidGroupBrowse);
end;

procedure CurPageChanged(CurPageID: Integer);
begin
  UpdateButton(WizardForm.BackButton,bidBack);
  UpdateButton(WizardForm.NextButton,bidNext);
  UpdateButton(WizardForm.CancelButton,bidCancel);

  ButtonLabel[bidBack].Left := ButtonPanel[bidBack].Width div 2 - ButtonLabel[bidBack].Width div 2;
  ButtonLabel[bidNext].Left := ButtonPanel[bidNext].Width div 2 - ButtonLabel[bidNext].Width div 2;
  ButtonLabel[bidCancel].Left := ButtonPanel[bidCancel].Width div 2 - ButtonLabel[bidCancel].Width div 2;
  ButtonLabel[bidDirBrowse].Left := ButtonPanel[bidDirBrowse].Width div 2 - ButtonLabel[bidDirBrowse].Width div 2;
  ButtonLabel[bidGroupBrowse].Left := ButtonPanel[bidGroupBrowse].Width div 2 - ButtonLabel[bidGroupBrowse].Width div 2;

  PageNameLabel.Caption := WizardForm.PageNameLabel.Caption;
  PageNameLabel.Font.Color := clWhite;
  InstStutus.Caption := WizardForm.PageDescriptionLabel.Caption;
end;

procedure CurStepChanged(CurStep: TSetupStep);
begin
  if CurStep = ssInstall then
    GenerateGUID(pGuid);

  if CurStep = ssPostInstall then
  begin
    AddToGameExplorer(ExpandConstant('{app}\dirt2.exe'), ExpandConstant('{app}'), 3, pGuid);
    CreateTask(3, pGuid, PlayTask, 0, 'Play', ExpandConstant('{app}\dirt2.exe'), '');
  end;
end;

procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
  if CurUninstallStep = usUninstall then
  begin
    RetrieveGUIDForApplication(ExpandConstant('{app}\dirt2.exe'), pGuid);
    RemoveFromGameExplorer(pGuid);
    RemoveTasks(pGuid);
    UnloadDll(ExpandConstant('{app}\GameuxInstallHelper.dll'));
  end;
end;



сделать фон прозрачный на всех страницах?

Отправлено: 21:38, 03-12-2009 | #564