Перейти из форума на сайт.

НовостиФайловые архивы
ПоискАктивные темыТоп лист
ПравилаКто в on-line?
Вход Забыли пароль? Первый раз на этом сайте? Регистрация
Компьютерный форум Ru.Board » Компьютеры » Программы » Inno Setup - создание инсталляционных пакетов (Часть 15)

Модерирует : gyra, Maz

 Версия для печати • ПодписатьсяДобавить в закладки
На первую страницук этому сообщениюк последнему сообщению

Открыть новую тему     Написать ответ в эту тему

vint56



Advanced Member
Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору

#define MyAppName "Almeza MultiSet Professional"
#define MyAppVersion "1.5"
#define MyAppExeName "MyProg.exe"
 
[Setup]
AppName={#MyAppName}
AppVersion={#MyAppVersion}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
DirExistsWarning=no
Uninstallable=not PortableCheck
 
[Languages]
Name: "russian"; MessagesFile: "compiler:Languages\Russian.isl"
 
[Files]
Source: Files\*; DestDir: {tmp}; Flags: dontcopy;
Source: "C:\Program Files (x86)\Inno Setup 5\Examples\MyProg.exe"; DestDir: "{app}"; Flags: ignoreversion; Check: RusLang and InstallerCheck;
Source: "C:\Program Files (x86)\Inno Setup 5\Examples\MyProg.exe"; DestDir: "{app}"; Flags: ignoreversion; Check: EngLang and InstallerCheck;
Source: "C:\Program Files (x86)\Inno Setup 5\Examples\MyProg.exe"; DestDir: "{app}"; Flags: ignoreversion; Check: UkrLang and InstallerCheck;
 
Source: "C:\Program Files (x86)\Inno Setup 5\Examples\MyProg.exe"; DestDir: "{commondesktop}\Portable"; Flags: ignoreversion uninsrestartdelete; Check: RusLang and PortableCheck;
Source: "C:\Program Files (x86)\Inno Setup 5\Examples\MyProg.exe"; DestDir: "{commondesktop}\Portable"; Flags: ignoreversion uninsrestartdelete; Check: EngLang and PortableCheck;
Source: "C:\Program Files (x86)\Inno Setup 5\Examples\MyProg.exe"; DestDir: "{commondesktop}\Portable"; Flags: ignoreversion uninsrestartdelete; Check: UkrLang and PortableCheck;
 
Source: {win}\Help\*; DestDir: {app}; Flags: external recursesubdirs; Check: RusLang and InstallerCheck;
Source: {win}\Help\*; DestDir: {app}; Flags: external recursesubdirs; Check: RusLang and PortableCheck;
 
 
[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}" ; Check: StartmenuCheck;
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"; Check: StartmenuCheck;
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Check: IconsCheck;
 
[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent; Check: RusLang and InstallerCheck;
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent; Check: EngLang and InstallerCheck;
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent; Check: UkrLang and InstallerCheck;
 
Filename: "{commondesktop}\Portable\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent; Check: RusLang and PortableCheck;
Filename: "{commondesktop}\Portable\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent; Check: EngLang and PortableCheck;
Filename: "{commondesktop}\Portable\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent; Check: UkrLang and PortableCheck;
 
[UninstallDelete]
Name: {app}\multiset.ini; Type: filesandordirs
 
[Code]
var
  Component: TWizardPage;
  Portable,Installer,LangRus,LangEng,LangUkr: TNewRadioButton;
  FlagImage,InstallerImage,PortableImage: TBitmapImage;
  Lang,IconsPanelLabel: TLabel;
  IconsPanel: TPanel;
  Icons,Startmenu: TNewCheckBox;
 
  dirBrowseForm: TSetupForm;
  dirBrowse, dirOK, dirNO, dirback: TButton;
  DirTreeView: TFolderTreeView;
  Edit: TNewEdit;
  BrowseBevel: TBevel;
  BrowsePanel: TPanel;
  BrowsePanel2: TPanel;
  BrowseBevel2,BrowseBevel3: TBevel;
  BrowseForm : TSetupForm;
 
 
function InitializeSetup(): Boolean;
begin
  if not FileExists(ExpandConstant('{tmp}\rus.bmp')) then ExtractTemporaryFile('rus.bmp');
  if not FileExists(ExpandConstant('{tmp}\eng.bmp')) then ExtractTemporaryFile('eng.bmp');
  if not FileExists(ExpandConstant('{tmp}\ukr.bmp')) then ExtractTemporaryFile('ukr.bmp');
  if not FileExists(ExpandConstant('{tmp}\Installer.bmp')) then ExtractTemporaryFile('Installer.bmp');
  if not FileExists(ExpandConstant('{tmp}\Portable.bmp')) then ExtractTemporaryFile('Portable.bmp');
  Result := True;
end;
 
function RusLang: Boolean;
begin
  Result:= LangRus.Checked;
end;
function EngLang: Boolean;
begin
  Result:= LangEng.Checked;
end;
function UkrLang: Boolean;
begin
  Result:= LangUkr.Checked;
end;
 
function IconsCheck: Boolean;
begin
  Result:= Icons.Checked;
end;
function StartmenuCheck: Boolean;
begin
  Result:= Startmenu.Checked;
end;
 
function InstallerCheck: Boolean;
begin
  Result := Installer.Checked;
end;
function PortableCheck: Boolean;
begin
  Result := Portable.Checked;
end;
 
procedure CopmpClick(Sender: TObject);
begin
  case TNewRadioButton(Sender) of
    Portable:
    begin
    PortableImage.Show;
    Icons.Checked:=False;
    Icons.Enabled:= Icons.Checked;
    Startmenu.Checked:=False;
    Startmenu.Enabled:= Startmenu.Checked;
    WizardForm.DirEdit.Text := AddBackslash(ExpandConstant('{commondesktop}')) + 'Almeza MultiSet Professional Portable';
    //wizardform.GroupEdit.enabled:= false;
    //wizardform.GroupBrowseButton.enabled:= false;
    end;
    Installer:
    begin
    PortableImage.Hide;
    Icons.Checked:=True;
    Icons.Enabled:= Icons.Checked;
    Startmenu.Checked:=True;
    Startmenu.Enabled:= Startmenu.Checked;
    WizardForm.DirEdit.Text := AddBackslash(ExpandConstant('{pf}')) + 'Almeza MultiSet Professional';
    //wizardform.GroupEdit.enabled:= true;
    //wizardform.GroupBrowseButton.enabled:= true;
  end;
end;
end;
 
procedure LangClick(Sender: TObject);
begin
  case TNewRadioButton(Sender) of
    LangRus:
    begin
    FlagImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\rus.bmp'));
    FlagImage.Width := ScaleX(100);
    FlagImage.Height := ScaleY(60);
    FlagImage.Left := ScaleX(250);
    end;
    LangEng:
    begin
    FlagImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\eng.bmp'));
    FlagImage.Width := ScaleX(100);
    FlagImage.Height := ScaleY(60);
    FlagImage.Left := ScaleX(250);
    end;
    LangUkr:
    begin
    FlagImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\ukr.bmp'));
    FlagImage.Width := ScaleX(100);
    FlagImage.Height := ScaleY(60);
    FlagImage.Left := ScaleX(250);
    end;
  end;
end;
 
procedure dirOkclick(Sender: TObject);
  begin
  dirBrowseForm.Close;
  WizardForm.Enabled:=True;
  WizardForm.DirEdit.Text:=Edit.Text;
end;
 
procedure dirBackClick(Sender: TObject);
  begin
  Edit.Text:=AddBackslash(ExpandConstant('{pf}\')+'{#MyAppName}');
  DirTreeView.ChangeDirectory(AddBackslash(ExpandConstant('{pf}\')), True);
end;
 
procedure dirNOclick(Sender: TObject);
  begin
  dirBrowseForm.Close;
  WizardForm.Enabled:=true;
end;
 
procedure DirFolderChange(Sender: TObject);
  Begin
  Edit.Text:=AddBackslash(DirTreeView.Directory) + '{#MyAppName}';
  if Portable.Checked then
  Edit.Text:=AddBackslash(DirTreeView.Directory) + 'Almeza MultiSet Professional Portable';
end;
 
procedure FormClosedir(Sender: TObject; var Action: TCloseAction);
  begin
  WizardForm.Enabled:=true;
end;
 
procedure BrowseClick(Sender: TObject);
begin
  dirBrowseForm := CreateCustomForm();
with dirBrowseForm do begin
  ClientWidth := ScaleX(352);
  ClientHeight := ScaleY(388);
  CenterInsideControl(WizardForm, False);
  Caption:='Обзор папок';
  onClose:=@FormClosedir;
 
with tlabel.create(dirBrowseForm) do begin
  SetBounds(ScaleX(15),ScaleY(15),ScaleX(350),ScaleY(15));
  caption:='Выберите папку из списка и нажмите «ОK».';
  parent:=dirBrowseForm;
  Font.Color:=clBlack;
  Font.Size:=8;
 
  BrowseBevel := TBevel.Create(WizardForm);
  BrowseBevel.SetBounds(ScaleX(0),ScaleY(40),ScaleX(352),ScaleY(2));
  BrowseBevel.parent:=dirBrowseForm;
 
  BrowseBevel3 := TBevel.Create(WizardForm);
  BrowseBevel3.SetBounds(ScaleX(0),ScaleY(342),ScaleX(352),ScaleY(2));
  BrowseBevel3.parent:=dirBrowseForm;
 
  BrowsePanel := TPanel.Create(WizardForm);
with BrowsePanel do
begin
  parent:=dirBrowseForm;
  Left := ScaleX(5);
  Top := ScaleY(45);
  Width := ScaleX(342);
  Height := ScaleY(292);
  Caption := '';
end;
  BrowsePanel2 := TPanel.Create(WizardForm);
with BrowsePanel2 do
begin
  BrowsePanel2.Parent := BrowsePanel;
  Left := ScaleX(5);
  Top := ScaleY(5);
  Width := ScaleX(332);
  Height := ScaleY(282);
  BevelOuter := bvLowered;
  Caption := '';
end;
  BrowseBevel2 := TBevel.Create(WizardForm);
with BrowseBevel2 do
begin
  BrowseBevel2.Parent := BrowsePanel2;
  Left := ScaleX(5);
  Top := ScaleY(5);
  Width := ScaleX(322);
  Height := ScaleY(272);
  Style := bsRaised;
end;
 
  Edit:= TNewEdit.Create(dirBrowseForm);
with edit do begin
  SetBounds(ScaleX(10),ScaleY(10),ScaleX(311),ScaleY(21));
  Text:=WizardForm.DirEdit.text;
  Parent:= BrowsePanel2;
  Font.Color:=clBlack;
end;
 
  DirTreeView:= TFolderTreeView.Create(dirBrowseForm)
with DirTreeView do begin
  SetBounds(ScaleX(10),ScaleY(35),ScaleX(311),ScaleY(235));
  OnChange:=@DirFolderChange;
  Parent:=BrowsePanel2;
end;
 
  dirback:=tbutton.create(dirBrowseForm)
with dirback do begin
  SetBounds(ScaleX(16),ScaleY(351),ScaleX(100),ScaleY(30));
  parent:=dirBrowseForm;
  Caption:='Сброс';
  onclick:=@dirBackClick;
end;
 
  dirok:=tbutton.create(dirBrowseForm)
with dirok do begin
  SetBounds(ScaleX(126),ScaleY(351),ScaleX(100),ScaleY(30));
  parent:=dirBrowseForm;
  Caption:='OK';
  onclick:=@dirOKclick;
end;
 
  dirno:=tbutton.create(dirBrowseForm)
with dirno do begin
  SetBounds(ScaleX(236),ScaleY(351),ScaleX(100),ScaleY(30));
  parent:=dirBrowseForm;
  Caption:='Отмена';
  onclick:=@dirNOclick;
end;
end;
end;
  DirTreeView.ChangeDirectory(AddBackslash(WizardForm.dirEdit.Text), true);
  Edit.Text:=(DirTreeView.Directory);
  dirBrowseForm.Show;
  WizardForm.Enabled:=false;
end;
 
procedure InitializeWizard();
begin
  WizardForm.DirBrowseButton.Visible:=false;
  Component := CreateCustomPage(wpInfoBefore, 'Выбор компонентов', 'Какие компоненты должны быть установлены?');
 
  FlagImage := TBitmapImage.Create(WizardForm);
  with FlagImage do
  begin
    Name := 'FlagImage';
    Parent := Component.Surface;
    Left := ScaleX(250);
    Top := ScaleY(134);
    Width := ScaleX(100);
    Height := ScaleY(60);
  end;
 
  IconsPanel := TPanel.Create(WizardForm);
  with IconsPanel do
  begin
    Parent := Component.Surface;
    Left := ScaleX(0);
    Top := ScaleY(0);
    Width := ScaleX(417);
    Height := ScaleY(100);
    BevelOuter := bvNone;
  end;
 
  InstallerImage := TBitmapImage.Create(WizardForm);
  with InstallerImage do
  begin
    Name := 'InstallerImage';
    Parent := IconsPanel;
    Left := ScaleX(255);
    Top := ScaleY(15);
    Width := ScaleX(80);
    Height := ScaleY(80);
    InstallerImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\Installer.bmp'));
  end;
 
  PortableImage := TBitmapImage.Create(WizardForm);
  with PortableImage do
  begin
    Name := 'PortableImage';
    Parent := IconsPanel;
    Left := ScaleX(255);
    Top := ScaleY(15);
    Width := ScaleX(80);
    Height := ScaleY(80);
    PortableImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\Portable.bmp'));
  end;
 
  IconsPanelLabel := TLabel.Create(WizardForm);
  with IconsPanelLabel do
  begin
    Parent := IconsPanel;
    Caption := 'Тип и компоненты:';
    Left := ScaleX(0);
    Top := ScaleY(5);
    Width := ScaleX(150);
    Height := ScaleY(13);
  end;
 
  Portable := TNewRadioButton.Create(WizardForm);
  with Portable do
  begin
    Parent := IconsPanel;
    Left := ScaleX(5);
    Top := ScaleY(25);
    Width := ScaleX(200);
    Height := ScaleY(17);
    Caption := 'Распаковка портативной версий';
    OnClick:=@CopmpClick;
  end;
 
  Icons := TNewCheckBox.Create(WizardForm);
  with Icons do
  begin
    Parent := IconsPanel;
    Left := ScaleX(25);
    Top := ScaleY(65);
    Width := ScaleX(200);
    Height := ScaleY(17);
    Caption := 'Ярлык(и) на «Рабочем столе»';
    Checked:=True;
  end;
 
  Startmenu := TNewCheckBox.Create(WizardForm);
  with Startmenu do
  begin
    Parent := IconsPanel;
    Left := ScaleX(25);
    Top := ScaleY(85);
    Width := ScaleX(200);
    Height := ScaleY(17);
    Caption := 'Ярлык в «Пуск меню»';
    Checked:=True;
  end;
 
  Installer := TNewRadioButton.Create(WizardForm);
  with Installer do
  begin
    Parent := IconsPanel;
    Left := ScaleX(5);
    Top := ScaleY(45);
    Width := ScaleX(200);
    Height := ScaleY(17);
    Caption := 'Установка обычной версий';
    OnClick:=@CopmpClick;
    Checked:=True;
  end;
 
  Lang := TLabel.Create(WizardForm);
  with Lang do
  begin
    Parent := Component.Surface;
    Caption := 'Язык интерфейса:';
    Left := ScaleX(0);
    Top := ScaleY(120);
    Width := ScaleX(150);
    Height := ScaleY(13);
  end;
 
  LangRus := TNewRadioButton.Create(WizardForm);
  with LangRus do
  begin
    Parent := Component.Surface;
    Left := ScaleX(5);
    Top := ScaleY(135);
    Width := ScaleX(200);
    Height := ScaleY(17);
    Caption := 'Язык интерфейса Русский';
    OnClick:=@LangClick;
    Checked:=True;
  end;
 
  LangEng := TNewRadioButton.Create(WizardForm);
  with LangEng do
  begin
    Parent := Component.Surface;
    Left := ScaleX(5);
    Top := ScaleY(155);
    Width := ScaleX(200);
    Height := ScaleY(17);
    Caption := 'Язык интерфейса Английский';
    OnClick:=@LangClick;
  end;
 
  LangUkr := TNewRadioButton.Create(WizardForm);
  with LangUkr do
  begin
    Parent := Component.Surface;
    Left := ScaleX(5);
    Top := ScaleY(175);
    Width := ScaleX(200);
    Height := ScaleY(17);
    Caption := 'Язык интерфейса Украйнский';
    OnClick:=@LangClick;
  end;
    dirBrowse:=tbutton.create(WizardForm);
    with dirBrowse do begin
    Parent := WizardForm.SelectDirPage;
    SetBounds(ScaleX(342),ScaleY(80),ScaleX(75),ScaleY(23));
    Caption:='Обзор...';
    OnClick:=@BrowseClick;
end;
end;
 
function ShouldSkipPage(PageID: Integer): Boolean;
begin
  if Portable.Checked then
  if (PageID = 8) then
  Result:= True;
end;
 
procedure CurStepChanged(CurStep: TSetupStep);
begin
  if (CurStep = ssPostInstall) then
  if Installer.Checked and RusLang then
  SetIniString('gereral', 'language', 'russian', ExpandConstant('{app}\multiset.ini'));
   if Installer.Checked and EngLang then
  SetIniString('gereral', 'language', 'english', ExpandConstant('{app}\multiset.ini'));
   if Installer.Checked and UkrLang then
  SetIniString('gereral', 'language', 'ukrainian', ExpandConstant('{app}\multiset.ini'));
end;

Всего записей: 1277 | Зарегистр. 07-10-2008 | Отправлено: 18:07 05-01-2014
Открыть новую тему     Написать ответ в эту тему

На первую страницук этому сообщениюк последнему сообщению

Компьютерный форум Ru.Board » Компьютеры » Программы » Inno Setup - создание инсталляционных пакетов (Часть 15)


Реклама на форуме Ru.Board.

Powered by Ikonboard "v2.1.7b" © 2000 Ikonboard.com
Modified by Ru.B0ard
© Ru.B0ard 2000-2024

BitCoin: 1NGG1chHtUvrtEqjeerQCKDMUi6S6CG4iC

Рейтинг.ru