码迷,mamicode.com
首页 > 其他好文 > 详细

innosetup完整脚本

时间:2015-12-13 11:12:26      阅读:945      评论:0      收藏:0      [点我收藏+]

标签:

#define MyAppName "Somarto"
#define MyAppVersion "1.0.0"
#define MyAppPublisher "XXXXXX有限公司"
#define MyAppURL "http://www.XXX.cn/"
#define MyAppExeName "Somarto.exe"
#define MyAppRegUninstall "Software\Microsoft\Windows\CurrentVersion\Uninstall\"
[Setup]
AppId={{A08292BB-197A-4DAE-A8E9-7D27155AD8A9}
AppName={#MyAppName}{#MyAppVersion}
AppVerName={#MyAppName}{#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\Somarto
VersionInfoCopyright=Copyright @ 2011 -2018 XXX. All Rights Reserved
DefaultGroupName={#MyAppName}
OutputDir=D:\CKM\Somarto\setup
OutputBaseFilename=Somarto-64
SetupIconFile=D:\CKM\Somarto\style\dns32.ico
Compression=lzma
SolidCompression=yes
ArchitecturesAllowed=x64
ArchitecturesInstallIn64BitMode=x64
[Languages]
;Name: "chinesesimp"; MessagesFile: "compiler:Default.isl" ;Name: "english"; MessagesFile: "compiler:Languages\English.isl"
Name: "englishsimp"; MessagesFile: "compiler:Default.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: checkablealone;
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: checkablealone

[Files]
Source: "D:\CKM\Somarto\bin\Debug\Somarto.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\CKM\Somarto\bin\Debug\SomartoGame.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\CKM\Somarto\bin\Debug\Coding4Fun.Kinect.WinForm.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\CKM\Somarto\bin\Debug\Coding4Fun.Kinect.Wpf.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\CKM\Somarto\bin\Debug\Fleck.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\CKM\Somarto\bin\Debug\FluorineFx.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\CKM\Somarto\bin\Debug\Fx.config"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\CKM\Somarto\bin\Debug\Somarto.exe.config"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\CKM\Somarto\bin\Debug\Kinect.Services.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\CKM\Somarto\bin\Debug\Kinect.Toolbox.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\CKM\Somarto\bin\Debug\log4net.config"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\CKM\Somarto\bin\Debug\log4net.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\CKM\Somarto\bin\Debug\sys.ini"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\CKM\Somarto\style\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs ;Source: "*.*"; DestDir: "{app}"; Flags: recursesubdirs createallsubdirs; BeforeInstall: ChangeDisplay
; 注意: 不要在任何共享系统文件上使用“Flags: ignoreversion”

[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon

[Registry]
Root: HKLM; Subkey: "software\Microsoft\Windows\CurrentVersion\Run"; ValueType: string; ValueName: "Somarto"; ValueData: "{app}\Somarto.exe"; Flags: uninsdeletevalue
;Root: HKLM; Subkey: "software\Somarto"; ValueType: string; ValueName: "Install"; ValueData: "{app}"; Flags: uninsdeletevalue Root: HKLM; Subkey: "Software\Microsoft\Windows\CurrentVersion\Uninstall\{#MyAppName}"; ValueType:string;ValueName:"UninstallString";ValueData:"{app}\unins000.exe" ; Flags:uninsdeletekey
[Code]
var
hasRun:HWND;
resultCode: Integer;
resultStr:String;
function InitializeSetup(): Boolean;
begin
Result := True;
begin
if RegKeyExists(HKLM, ‘{#MyAppRegUninstall}{A08292BB-197A-4DAE-A8E9-7D27155AD8A9}_is1‘) then
begin
if MsgBox(‘安装程序检测到【Somarto】的一个版本已安装。‘#13#10‘选择“是”将覆盖安装。‘#13#10‘选择“否”退出安装程序,放弃安装。‘, mbConfirmation, MB_YESNO) = IDYES then
begin
hasRun := FindWindowByWindowName(‘Somarto‘);
while (hasRun <> 0) do
begin
MsgBox(‘【Somarto】的一个版本正在运行,‘#13#10‘应用程序将自动退出。‘,mbConfirmation, MB_OK);
PostMessage(hasRun,18,0,0);
Sleep(3);
hasRun :=0;
end;
Result := True;
end else
begin
Result := False;
exit;
end;
end;
end;

begin
if RegQueryStringValue(HKLM, ‘{#MyAppRegUninstall}{A08292BB-197A-4DAE-A8E9-7D27155AD8A9}_is1‘, ‘UninstallString‘, ResultStr) then
begin
ResultStr := RemoveQuotes(ResultStr);
Exec(resultStr, ‘/VERYSILENT‘, ‘‘, SW_HIDE, ewWaitUntilTerminated, resultCode);
end;
end;

end;


procedure InitializeWizard();
begin
begin
WizardForm.WizardSmallBitmapImage.Top := ScaleY(0);
WizardForm.WizardSmallBitmapImage.Left := ScaleX(0);
WizardForm.WizardSmallBitmapImage.Width := WizardForm.MainPanel.Width;
WizardForm.WizardSmallBitmapImage.Height := WizardForm.MainPanel.Height;
WizardForm.PageNameLabel.width:=40; //设置标题文字显示的大小
WizardForm.PageDescriptionLabel.width:= 230; //设置标题文字显示的大小

end;
end;


function InitializeUninstall(): Boolean;
begin
begin
hasRun := FindWindowByWindowName(‘Somarto‘);
if hasRun<>0 then
begin
MsgBox(‘【Somarto】应用程序正在运行。‘ #13#10 ‘请先退出您的应用程序,然后再进行卸载。‘, mbInformation, MB_OK);
Result := false;
exit;
end;
end;
begin
DelTree(ExpandConstant(‘{app}‘), True, True, True);
RegDeleteKeyIncludingSubkeys(HKEY_CURRENT_USER, ‘Software\icc‘);
end;
Result := true;
end;

[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, ‘&‘, ‘&&‘)}}"; Flags: nowait postinstall skipifsilent

 

innosetup完整脚本

标签:

原文地址:http://www.cnblogs.com/fx2008/p/5042418.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!