• innosetup完整脚本


    #define MyAppName "Somarto"
    #define MyAppVersion "1.0.0"
    #define MyAppPublisher "XXXXXX有限公司"
    #define MyAppURL "http://www.XXX.cn/"
    #define MyAppExeName "Somarto.exe"
    #define MyAppRegUninstall "SoftwareMicrosoftWindowsCurrentVersionUninstall"
    [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:CKMSomartosetup
    OutputBaseFilename=Somarto-64
    SetupIconFile=D:CKMSomartostyledns32.ico
    Compression=lzma
    SolidCompression=yes
    ArchitecturesAllowed=x64
    ArchitecturesInstallIn64BitMode=x64
    [Languages]
    ;Name: "chinesesimp"; MessagesFile: "compiler:Default.isl" ;Name: "english"; MessagesFile: "compiler:LanguagesEnglish.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:CKMSomartoinDebugSomarto.exe"; DestDir: "{app}"; Flags: ignoreversion
    Source: "D:CKMSomartoinDebugSomartoGame.exe"; DestDir: "{app}"; Flags: ignoreversion
    Source: "D:CKMSomartoinDebugCoding4Fun.Kinect.WinForm.dll"; DestDir: "{app}"; Flags: ignoreversion
    Source: "D:CKMSomartoinDebugCoding4Fun.Kinect.Wpf.dll"; DestDir: "{app}"; Flags: ignoreversion
    Source: "D:CKMSomartoinDebugFleck.dll"; DestDir: "{app}"; Flags: ignoreversion
    Source: "D:CKMSomartoinDebugFluorineFx.dll"; DestDir: "{app}"; Flags: ignoreversion
    Source: "D:CKMSomartoinDebugFx.config"; DestDir: "{app}"; Flags: ignoreversion
    Source: "D:CKMSomartoinDebugSomarto.exe.config"; DestDir: "{app}"; Flags: ignoreversion
    Source: "D:CKMSomartoinDebugKinect.Services.dll"; DestDir: "{app}"; Flags: ignoreversion
    Source: "D:CKMSomartoinDebugKinect.Toolbox.dll"; DestDir: "{app}"; Flags: ignoreversion
    Source: "D:CKMSomartoinDebuglog4net.config"; DestDir: "{app}"; Flags: ignoreversion
    Source: "D:CKMSomartoinDebuglog4net.dll"; DestDir: "{app}"; Flags: ignoreversion
    Source: "D:CKMSomartoinDebugsys.ini"; DestDir: "{app}"; Flags: ignoreversion
    Source: "D:CKMSomartostyle*"; 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: "softwareMicrosoftWindowsCurrentVersionRun"; ValueType: string; ValueName: "Somarto"; ValueData: "{app}Somarto.exe"; Flags: uninsdeletevalue
    ;Root: HKLM; Subkey: "softwareSomarto"; ValueType: string; ValueName: "Install"; ValueData: "{app}"; Flags: uninsdeletevalue Root: HKLM; Subkey: "SoftwareMicrosoftWindowsCurrentVersionUninstall{#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.=40; //设置标题文字显示的大小
    WizardForm.PageDescriptionLabel.= 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, 'Softwareicc');
    end;
    Result := true;
    end;

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

  • 相关阅读:
    倒序三角形
    有时间了
    测试一个数是不是素数
    初学C++编写小程序
    N!的递归调用
    1+...+5的递归调用
    1!+....+5!
    菱形块
    23.git简单使用
    27.flask学习
  • 原文地址:https://www.cnblogs.com/fx2008/p/5042418.html
Copyright © 2020-2023  润新知