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

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

Аватара для Dodakaedr

Ветеран


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

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


Цитата Uragan66:
чтобы конечные папки DestDir у распаковки и установки были разные »
Скрытый текст
Код: Выделить весь код
[Setup]
AppName=My Program
AppVerName=My Program
DefaultDirName={pf}\My Program
OutputDir=.
Uninstallable=IsChecked
CreateUninstallRegKey=IsChecked

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

[Tasks]
; Дополнительно
; Ярлык(и) на «Рабочем столе»
Name: "desktopicon"; Description: "Ярлык(и) на «Рабочем столе»"; GroupDescription: "Дополнительно:"; Check: IsChecked
; Ярлыки в меню «Пуск»
Name: "starticon"; Description: "Ярлыки в меню «Пуск»"; GroupDescription: "Дополнительно:"; Check: IsChecked

[Icons]
Name: "{group}\My Program"; Filename: "{uninstallexe}"; Tasks: starticon; Check: not IsChecked
Name: "{commondesktop}\My Program"; Filename: "{uninstallexe}"; Tasks: desktopicon; Check: IsChecked

[Files]
; Файлы для проверки и демонстрации. При реальном использовании - закомментировать или удалить!
Source: {win}\Help\*; DestDir: {app}; Flags: external recursesubdirs

[CustomMessages]
HeaderLabelPage=Выбор типа установки
LabelPage=Выберите нужный тип установки
MyRadioCaption_1=Распаковка
MyRadioCaption_2=Обычная установка
PageTextHeader=На этой странице Вы можете выбрать тип установки, который для Вас наиболее удобен.
MyText_1=Будет произведена распаковка в паку,%nуказанную на следующей странице
MyText_2=Будет произведена стандартная установка
Extracted=Распаковка — %1
ExtractedFolder=Выбор папки распаковки
ExtractedFolder2=В какую папку вы хотите распаковать %1?
ExtractedFolder3=Программа распакует %1 в следующую папку.
ExtractedFolder4=Программа установит %1 в следующую папку.
Installing=Распаковка...
InstallingLabel=Пожалуйста, подождите, пока %1 распакуется на ваш компьютер.
FinishedHeadingLabel=Завершение распаковки%n%1
FinishedLabelNoIcons=Программа %1 распакована на Ваш компьютер.%n%nНажмите «Завершить», чтобы выйти из программы распаковки.

[UninstallDelete]
Type: filesandordirs; Name: {app}

[code]
const
  DI_NORMAL = 3;

var
  MyNewPage: TWizardPage;
  Rect: TRect;
  HIcon: LongInt;
  AIconFileName: String;
  MyRadioBtn_1, MyRadioBtn_2: TNewRadioButton;

function GetModuleHandle(lpModuleName: LongInt): LongInt; external 'GetModuleHandleA@kernel32.dll stdcall';
function ExtractIcon(hInst: LongInt; lpszExeFileName: AnsiString; nIconIndex: LongInt): LongInt; external 'ExtractIconA@shell32.dll stdcall';
function DrawIconEx(hdc: LongInt; xLeft, yTop: Integer; hIcon: LongInt; cxWidth, cyWidth: Integer; istepIfAniCur: LongInt; hbrFlickerFreeDraw, diFlags: LongInt): LongInt;external 'DrawIconEx@user32.dll stdcall';
function DestroyIcon(hIcon: LongInt): LongInt; external 'DestroyIcon@user32.dll stdcall';

function IsChecked: Boolean;
begin
  Result:= MyRadioBtn_2.checked;
end;

procedure RadBtnOnClick(Sender: TObject);
begin
  case Sender of
    MyRadioBtn_1: begin
      WizardForm.Caption:= FmtMessage(ExpandConstant('{cm:Extracted}'), [ExpandConstant('{#SetupSetting("AppName")}')]);
      WizardForm.SelectDirLabel.Caption:= FmtMessage(ExpandConstant('{cm:ExtractedFolder3}'), [ExpandConstant('{#SetupSetting("AppName")}')]);
    end;
    MyRadioBtn_2: begin
      WizardForm.Caption:= FmtMessage(SetupMessage(msgSetupWindowTitle), [ExpandConstant('{#SetupSetting("AppName")}')]);
      WizardForm.SelectDirLabel.Caption:= FmtMessage(ExpandConstant('{cm:ExtractedFolder4}'), [ExpandConstant('{#SetupSetting("AppName")}')]);
    end;
  end;
end;

procedure GetInstTypePage();
begin
  MyNewPage:= CreateCustomPage(wpWelcome, ExpandConstant('{cm:HeaderLabelPage}'), ExpandConstant('{cm:LabelPage}'));

  try
    // в конкретном примере из этого файла (C:\Windows\System32\shell32.dll) берём иконки, для пробного показа.
    // Можно использовать обычные .ico
    AIconFileName:= ExpandConstant('{sys}\shell32.dll');
    //

    Rect.Left:= 0;
    Rect.Top:= 0;
    Rect.Right:= 32;
    Rect.Bottom:= 32;

    hIcon:= ExtractIcon(GetModuleHandle(0), AIconFileName, 26);
    try
      with TBitmapImage.Create(WizardForm) do begin
        Left:= ScaleX(15);
        Top:= ScaleY(68);
        Width:= 32;
        Height:= 32;
        with Bitmap do begin
          Width:= 32;
          Height:= 32;
          Canvas.Brush.Color:= clBtnFace;
          Canvas.FillRect(Rect);
          DrawIconEx(Canvas.Handle, 0, 0, HIcon, 32, 32, 0, 0, DI_NORMAL);
        end;
        Parent:= MyNewPage.Surface;
      end;
     finally
     DestroyIcon(hIcon);
    end;

    hIcon:= ExtractIcon(GetModuleHandle(0), AIconFileName, 19);
    try
      with TBitmapImage.Create(WizardForm) do begin
        Left:= ScaleX(15);
        Top:= ScaleY(138);
        Width:= 32;
        Height:= 32;
        with Bitmap do begin
          Width:= 32;
          Height:= 32;
          Canvas.Brush.Color:= clBtnFace;
          Canvas.FillRect(Rect);
          DrawIconEx(Canvas.Handle, 0, 0, HIcon, 32, 32, 0, 0, DI_NORMAL);
        end;
        Parent:= MyNewPage.Surface;
      end;
     finally
     DestroyIcon(hIcon);
    end;
   except
  end;

  with TNewStaticText.Create(WizardForm) do begin
    Width:= WizardForm.InnerNotebook.Width;
    Height:= ScaleY(26);
    WordWrap:= True;
    Caption:= ExpandConstant('{cm:PageTextHeader}');
    Parent:= MyNewPage.Surface;
  end;

  MyRadioBtn_1:= TNewRadioButton.Create(WizardForm);
  with MyRadioBtn_1 do begin
    Top:= ScaleY(50);
    Width:= ScaleX(150);
    Caption:= ExpandConstant('{cm:MyRadioCaption_1}');
    OnClick:= @RadBtnOnClick;
    Parent:= MyNewPage.Surface;
  end;

  with TNewStaticText.Create(WizardForm) do begin
    Left:= ScaleX(60);
    Top:= ScaleY(68);
    Width:= WizardForm.InnerNotebook.Width - ScaleX(60);
    Height:= ScaleY(26);
    WordWrap:= True;
    Caption:= ExpandConstant('{cm:MyText_1}');
    Parent:= MyNewPage.Surface;
  end;

  MyRadioBtn_2:= TNewRadioButton.Create(WizardForm);
  with MyRadioBtn_2 do begin
    Top:= ScaleY(120);
    Width:= ScaleX(150);
    Caption:= ExpandConstant('{cm:MyRadioCaption_2}');
    Checked:= True;
    OnClick:= @RadBtnOnClick;
    Parent:= MyNewPage.Surface;
  end;

  with TNewStaticText.Create(WizardForm) do begin
    Left:= ScaleX(60);
    Top:= ScaleY(138);
    Width:= WizardForm.InnerNotebook.Width - ScaleX(60);
    Height:= ScaleY(26);
    WordWrap:= True;
    Caption:= ExpandConstant('{cm:MyText_2}');
    Parent:= MyNewPage.Surface;
  end;
end;

function ShouldSkipPage(PageID: Integer): Boolean;
begin
  if (PageID > wpSelectDir) and (PageID < wpInstalling) and (MyRadioBtn_1.Checked) then
     Result:= True;
end;

procedure InitializeWizard();
begin
  GetInstTypePage();
  WizardForm.DiskSpaceLabel.Hide;
end;

procedure CurPageChanged(CurPageID: Integer);
begin
  if not IsChecked then begin
    case CurPageID of
      wpSelectDir: begin
	WizardForm.Caption:= FmtMessage(ExpandConstant('{cm:Extracted}'), [ExpandConstant('{#SetupSetting("AppName")}')]);
	WizardForm.PageNameLabel.Caption:= ExpandConstant('{cm:ExtractedFolder}');
	WizardForm.PageDescriptionLabel.Caption:= FmtMessage(ExpandConstant('{cm:ExtractedFolder2}'), [ExpandConstant('{#SetupSetting("AppName")}')]);
	WizardForm.SelectDirLabel.Caption:= FmtMessage(ExpandConstant('{cm:ExtractedFolder3}'), [ExpandConstant('{#SetupSetting("AppName")}')]);
  if IsChecked then
    WizardForm.DirEdit.Text := ExpandConstant( '{pf}\{#SetupSetting("AppName")}' ) else
    WizardForm.DirEdit.Text := ExpandConstant( '{src}\{#SetupSetting("AppName")}' );
      end;
      wpInstalling: begin
	WizardForm.PageNameLabel.Caption:= ExpandConstant('{cm:Installing}');
	WizardForm.PageDescriptionLabel.Caption:= FmtMessage(ExpandConstant('{cm:InstallingLabel}'), [ExpandConstant('{#SetupSetting("AppName")}')]);
      end;
      wpFinished: begin
	WizardForm.FinishedHeadingLabel.Caption:= FmtMessage(ExpandConstant('{cm:FinishedHeadingLabel}'), [ExpandConstant('{#SetupSetting("AppName")}')]);
	WizardForm.FinishedLabel.Caption:= FmtMessage(ExpandConstant('{cm:FinishedLabelNoIcons}'), [ExpandConstant('{#SetupSetting("AppName")}')]);
      end;
    end;
  end;
end;

-------
Inno Setup 5 Ultra Unicode

Это сообщение посчитали полезным следующие участники:

Отправлено: 22:24, 13-07-2015 | #785