innosetup完整脚本

#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

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值