#include "Embedded\idp.iss";
[Setup]
AppName= My Program
AppVersion= 1.0
DefaultDirName= C:\My Program
OutputDir=.
[Files]
Source: "Embedded\idp.dll"; Flags: dontcopy;
Source: "Embedded\7zA.exe"; DestDir: "{tmp}"; Flags: dontcopy;
[Code]
/// --- UnPack Begin --- ///
var
Music, Sound: TCheckBox;
function MakeMusic: Boolean;
begin Result:=Music.Checked;end;
function MakeSound: Boolean;
begin Result:=Sound.Checked;end;
procedure NoMusic(Sender: TObject);
begin
if Music.Checked = false then
end;
procedure NoSound(Sender: TObject);
begin
if Sound.Checked = false then
end;
procedure ExtractResources();
var
ResultCode: Integer;
begin
ExtractTemporaryFile('7zA.exe');
CreateDir(ExpandConstant('{app}\7zA_Files'));
CreateDir(ExpandConstant('{app}\Data'));
FileCopy(ExpandConstant('{tmp}\7zA.exe'), ExpandConstant('{app}\7zA_Files\7zA.exe'), False);
If MakeMusic and (FileExists(ExpandConstant('{app}\Example_1.7z'))) then
begin
Exec(ExpandConstant('{app}\7zA_Files\7zA.exe'), 'x -y ..\Example_1.7z -o..\Data', '', SW_Hide, ewWaitUntilTerminated, ResultCode);
DeleteFile(ExpandConstant('{app}\Example_1.7z'));
end;
If MakeSound and (FileExists(ExpandConstant('{app}\Example_2.7z'))) then
begin
Exec(ExpandConstant('{app}\7zA_Files\7zA.exe'), 'x -y ..\Example_2.7z -o..\Data', '', SW_Hide, ewWaitUntilTerminated, ResultCode);
DeleteFile(ExpandConstant('{app}\Example_2.7z'));
end;
DelTree(ExpandConstant('{app}\7zA_Files'), True, True, True);
end;
procedure CurStepChanged(CurStep: TSetupStep);
begin
If CurStep=ssDone then
begin
ExtractResources();
end;
end;
/// --- UnPack End --- ///
procedure CurPageChanged(CurPageID: Integer);
begin
if CurPageID = wpInstalling then
begin
if MakeMusic then
begin
idpAddFile('http://my-files.ru/DownloadSave/prs23k/Example_1.7z', ExpandConstant('{app}\Example_1.7z'));
end;
if MakeSound then
begin
idpAddFile('http://my-files.ru/DownloadSave/8tzoel/Example_2.7z', ExpandConstant('{app}\Example_2.7z'));
end;
end;
end;
procedure InitializeWizard();
begin
idpDownloadAfter(wpInstalling);
Music := TCheckBox.Create(WizardForm);
Music.Parent := WizardForm.SelectDirPage;
Music.Caption := 'Music';
Music.SetBounds(ScaleX(0),WizardForm.DirEdit.Top+ScaleY(45),ScaleX(400),ScaleY(25));
Music.TabOrder := 0;
Music.Checked:= false;
Music.OnClick:= @NoMusic;
Sound := TCheckBox.Create(WizardForm);
Sound.Parent := WizardForm.SelectDirPage;
Sound.Caption := 'Sound';
Sound.SetBounds(ScaleX(0),WizardForm.DirEdit.Top+ScaleY(65),ScaleX(400),ScaleY(25));
Sound.TabOrder := 0;
Sound.Checked:= false;
Sound.OnClick:= @NoSound;
end;