Inno Setupチュートリアル
13450 ワード
参考ブログ:導入インストールパッケージの作成:Inno Setup
参考資料:Inno Setup詳細チュートリアル
参考資料:Innosetup詳細チュートリアルの使用
个人使用的风铃夜思雨的汉化版
参考資料:Inno Setup詳細チュートリアル
参考資料:Innosetup詳細チュートリアルの使用
个人使用的风铃夜思雨的汉化版
; Inno Setup !
; Inno Setup !
#define MyAppName "xxxxxxxx"
#define MyAppName1 "xxxxxx"
#define MyAppName2 "xxxxxx"
#define MyAppVersion "1.00"
#define MyAppPublisher "xxx"
#define MyAppURL "http://www.xxx.com/"
#define MyAppExeName1 "xxxx.exe"
#define MyAppExeName2 "xxxx.exe"
;
[Setup]
; : AppId 。
; AppId 。
; ( GUID, | IDE GUID。)
AppId={{CF002CA5-9C74-491C-AF38-903CD91BF624}
;
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
; 、
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
;
AllowNoIcons=1
;
AlwaysShowComponentsList=1
;
AlwaysShowGroupOnReadyPage=1
AppCopyright=Copyright 2015 xxx
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
;
;AppModifyPath="{app}\Setup.exe"/modify=1
;
;ChangesEnvironment=1
;
;UserInfoPage=1
;
;DefaultUserInfoSerial=serial
;
;Password=pwd
;
;LicenseFile=license.txt
;
;InfoBeforeFile=infobefore.txt
;
;InfoAfterFile=infoafter.txt
;
;WindowVisible=1
; “3D”
FlatComponentsList=0
;
SetupIconFile=F:\xxx\xxx.ico
;
;UninstallDisplayIcon={app}\uninstall.ico
OutputDir=F:\xxx
OutputBaseFilename=xxx
Compression=lzma
SolidCompression=yes
; 。
[Types]
Name:"communication";Description:xxxx
Name:"client";Description:xxxx
; 。 ,
[Components]
Name:"communication";Description:{#MyAppName1};Types:communication
Name:"client";Description:{#MyAppName2};Types:client
[Languages]
Name: "chinesesimp"; MessagesFile: "compiler:Default.isl"
Name:"en";MessagesFile:"compiler:English.isl"
; 。 。
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 0,6.1
;
[Files]
Source: "F:\xxx\xxx\xxx.exe"; DestDir: "{app}"; Flags: ignoreversion;Components:communication
Source: "F:\xxx\xxx\xxx.exe.config"; DestDir: "{app}"; Flags: ignoreversion ;Components:communication
Source: "F:\xxx\xxx\xxx.exe"; DestDir: "{app}"; Flags: ignoreversion;Components:client
Source: "F:\xxx\xxx\xxx.exe.config"; DestDir: "{app}"; Flags: ignoreversion ;Components:client
; : “Flags: ignoreversion”
; /
; Add the ISSkin DLL used for skinning Inno Setup installations.
Source: compiler:ISSkin.dll; DestDir: {app}; Flags: dontcopy
; Add the Visual Style resource contains resources used for skinning,
; you can also use Microsoft Visual Styles (*.msstyles) resources.
Source: compiler:IsSkins\Codejock.cjstyles; DestDir: {tmp}; Flags: dontcopy
[Code]
// Importing LoadSkin API from ISSkin.DLL
procedure LoadSkin(lpszPath: AnsiString; lpszIniFileName: AnsiString);
external 'LoadSkin@files:isskin.dll stdcall';
// Importing UnloadSkin API from ISSkin.DLL
procedure UnloadSkin();
external 'UnloadSkin@files:isskin.dll stdcall';
// Importing ShowWindow Windows API from User32.DLL
function ShowWindow(hWnd: Integer; uType: Integer): Integer;
external '[email protected] stdcall';
function InitializeSetup(): Boolean;
var Path:string ;
ResultCode: Integer;
dotNetV4RegPath:string;
dotNetV4PackFile:string;
begin
ExtractTemporaryFile('Codejock.cjstyles');
LoadSkin(AnsiString(ExpandConstant('{tmp}\Codejock.cjstyles')), '');
//Result := True;
dotNetV4RegPath:='SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full';
dotNetV4PackFile:='{src}\dotNetFx40_Full_x86_x64.exe';
if RegKeyExists(HKLM, dotNetV4RegPath) then
begin
Result := true;
end
else
begin
Path := ExpandConstant(dotNetV4PackFile);
if(FileOrDirExists(Path)) then
begin
Exec(Path, '/qb', '', SW_SHOW, ewWaitUntilTerminated, ResultCode);
if RegKeyExists(HKLM, dotNetV4RegPath) then
begin
Result := true;
end
else
begin
MsgBox(' .Net Framework4.0 , , !',mbInformation,MB_OK);
end
end
else
begin
MsgBox(' .Net Framework4.0 , , !',mbInformation,MB_OK);
end
end;
end;
procedure DeinitializeSetup();
begin
// Hide Window before unloading skin so user does not get
// a glimse of an unskinned window before it is closed.
ShowWindow(StrToInt(ExpandConstant('{wizardhwnd}')), 0);
UnloadSkin();
end;
[Icons]
;{group} ,
Name: "{group}\{#MyAppName1}"; Filename: "{app}\{#MyAppExeName1}";Components:communication
;{group} ,
Name: "{group}\{#MyAppName2}"; Filename: "{app}\{#MyAppExeName2}";Components:client
;{commondesktop}&{userdesktop}
Name: "{commondesktop}\{#MyAppName1}"; Filename: "{app}\{#MyAppExeName1}"; Tasks: desktopicon;Components:communication
;{commondesktop}&{userdesktop}
Name: "{commondesktop}\{#MyAppName2}"; Filename: "{app}\{#MyAppExeName2}"; Tasks: desktopicon;Components:client
;{uninstallexe}
Name:"{group}\ {#MyAppName1}" ;Filename:"{uninstallexe}";IconFilename:"{app}\uninstall.ico";Components:communication
;{uninstallexe}
Name:"{group}\ {#MyAppName2}" ;Filename:"{uninstallexe}";IconFilename:"{app}\uninstall.ico";Components:client
; 。 、 / 。
; , 。 ,
;uninsdelete*
[Registry]
Root:HKLM;Subkey:"Software\xxx";Flags:uninsdeletekeyifempty
Root:HKLM;Subkey:"Software\xxx\communication";Flags:uninsdeletekey;Components:communication
Root:HKLM;Subkey:"Software\xxx\communication";ValueType:string;ValueName:"InstallPath";ValueData:"{app}";Components:communication
Root:HKLM;Subkey:"Software\xxx\client";Flags:uninsdeletekey;Components:client
Root:HKLM;Subkey:"Software\xxx\client";ValueType:string;ValueName:"InstallPath";ValueData:"{app}";Components:client
[UninstallDelete]
Type:filesandordirs;Name:"{app}\Log"
Type:filesandordirs;Name:"{app}\ErrorTrace.xml"
Type:filesandordirs;Name:"{app}\*.*"
; 。 ,
[Run]
Filename: "{app}\{#MyAppExeName1}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName1, '&', '&&')}}"; Flags: nowait postinstall skipifsilent;Components:communication
Filename: "{app}\{#MyAppExeName2}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName2, '&', '&&')}}"; Flags: nowait postinstall skipifsilent;Components:client