jitender
Code:
#define MyAppName "My Program"
#define MyAppVersion "1.5"
#define MyAppPublisher "My Company, Inc."
#define MyAppURL "http://www.example.com/"
#define MyAppExeName "MyProg.exe"
[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{AEB246C4-0FD6-4C59-8EEF-03944CDFDDA5}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={code:GetInstallDir|{pf}\My Application}
DisableProgramGroupPage=yes
Uninstallable=not PortableCheck
OutputDir=.
OutputBaseFilename=setup
Compression=none
SolidCompression=yes
BackColorDirection=lefttoright
[UninstallDelete]
Type: filesandordirs; Name: {app}
[Languages]
Name: english; MessagesFile: compiler:Default.isl
[Tasks]
Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked
[Files]
Source: Include\Splash.png; DestDir: {tmp}; Flags: dontcopy
Source: Include\isgsg.dll; DestDir: {tmp}; Flags: dontcopy
Source: "MyProg - installer.exe"; DestDir: "{app}"; Flags: ignoreversion; Check: InstallerCheck;
Source: "MyProg - portable.exe"; DestDir: "{app}"; Flags: ignoreversion; Check: PortableCheck;
[Icons]
Name: {commonprograms}\{#MyAppName}; Filename: {app}\{#MyAppExeName}
Name: {commondesktop}\{#MyAppName}; Filename: {app}\{#MyAppExeName}; Tasks: desktopicon; Check: InstallerCheck;
[Run]
Filename: {app}\{#MyAppExeName}; Description: {cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}; Flags: nowait postinstall skipifsilent
;Code section add [] to front of line.
var
URLText: TNewStaticText;
Portable,Installer: TNewRadioButton;
procedure ShowSplashScreen(p1:HWND;p2:AnsiString;p3,p4,p5,p6,p7:integer;p8:boolean;p9:Cardinal;p10 :integer);
external 'ShowSplashScreen@files:isgsg.dll stdcall delayload';
procedure URLTextClick(Sender: TObject);
var
ErrorCode: Integer;
begin
ShellExec('open', 'http://fileforums.com', '', '', SW_SHOWNORMAL, ewNoWait, ErrorCode);
end;
function CheckParam(s: string): boolean;
var
i: integer;
begin
for i := 0 to ParamCount do begin
Result := ParamStr(i) = s;
if Result then Break;
end;
end;
function GetInstallDir(S: String): String;
begin
if CheckParam('/P') then
Result:= ExpandConstant('{userdesktop}\My Application Portable')
else
Result:= ExpandConstant(S);
end;
function PortableCheck: Boolean;
begin
Result := Portable.Checked or CheckParam('/P');
end;
function InstallerCheck: Boolean;
begin
Result := Installer.Checked or CheckParam('/I');
end;
procedure NewRadioButton1Click(Sender: TObject);
begin
if Portable.Checked then
WizardForm.DirEdit.Text:= ExpandConstant('{userdesktop}\My Application Portable')
else
WizardForm.DirEdit.Text:= ExpandConstant('{pf}\My Application');
end;
procedure InitializeWizard();
begin
ExtractTemporaryFile('Splash.png');
ShowSplashScreen(WizardForm.Handle,ExpandConstant('{tmp}\Splash.png'), 1000, 1000, 1000, 0, 255, True, $FFFFFF, 10);
with WizardForm do begin
Color := $d78318;
end;
URLText := TNewStaticText.Create(WizardForm);
with URLText do begin
Parent := WizardForm;
Left := ScaleX(10);
Top := ScaleY(331);
Width := ScaleX(156);
Height := ScaleY(23);
Caption := 'My Website';
Cursor := crHand;
Color := clWhite;
Font.Style := [fsUnderline];
Transparent := True;
OnClick := @URLTextClick;
end;
Portable := TNewRadioButton.Create(WizardForm);
with Portable do
begin
Parent := WizardForm.SelectDirPage;
Left := ScaleX(110);
Top := ScaleY(175);
Width := ScaleX(100);
Height := ScaleY(17);
Caption := 'Портативная';
Checked := CheckParam('/P');
OnClick := @NewRadioButton1Click;
end;
Installer := TNewRadioButton.Create(WizardForm);
with Installer do
begin
Parent := WizardForm.SelectDirPage;
Left := ScaleX(0);
Top := ScaleY(175);
Width := ScaleX(100);
Height := ScaleY(17);
Caption := 'Стационарная';
Checked := not CheckParam('/P');
OnClick := @NewRadioButton1Click;
end;
end;