zoukankan      html  css  js  c++  java
  • 【转载】inno setup 水波纹效果,检测安装vcredist_x86.exe等

     以下inno setup脚本,实现了:1.水波纹效果 2.安装时检测是否安装其他版本,并在欢迎页面添加文字提示 4.检测安装vcredist_x86.exe  3.卸载时添加提示

    ; 脚本由 Inno Setup 脚本向导 生成!
    ; 有关创建 Inno Setup 脚本文件的详细资料请查阅帮助文档!
     
    #define MyAppName "GX_Standardizeddrawing_X64"
    #define MyAppVersion "2.5"
    #define MyAppPublisher "ZWSOFT"
    #define MyAppURL "www.zwcad.com"
    #define MyAppExeName "Gx_standardizeddrawing"    
    #define shortCutName "广西通信标准化制图"  
     
    [Setup]
    ; 注: AppId的值为单独标识该应用程序。
    ; 不要为其他安装程序使用相同的AppId值。
    ; (生成新的GUID,点击 工具|在IDE中生成GUID。)
    AppId={{904DF7AD-D92A-4E81-A8ED-F0EB51701FFC}
    AppName={#shortCutName}
    AppVersion={#MyAppVersion}
    ;AppVerName={#MyAppName} {#MyAppVersion}
    AppSupportURL={#MyAppURL}
    AppUpdatesURL={#MyAppURL}
    DefaultGroupName={#shortCutName}
    OutputBaseFilename=广西通信插件_V2.5
    DefaultDirName=D:{#MyAppName}
    Compression=lzma
    SolidCompression=yes
    UseSetupLdr=yes
    DisableWelcomePage=no
    ;WindowVisible=yes
    ;LicenseFile=E:GitHubSVNProjectwRQYWRQY_ZWCADlicense.txt
    WizardImageFile=.WizardImage.bmp
    WizardSmallImageFile=.WizardSmallImage.bmp
    AppPublisher=ZWSOFT
    AppPublisherURL=http://www.zwcad.com/
    AppCopyright=Copyright (C) 1998-2019 zwsof, Inc.
    OutputDir=.
    ;管理员权限
    PrivilegesRequired=admin 
    Uninstallable=yes
    UninstallDisplayName={#shortCutName}
    SetupIconFile = .SetupSetup
    eszwcad.ico
     
    ;覆盖安装
    UsePreviousAppDir = yes
     
     
    [Messages]
    BeveledLabel=广州中望龙腾软件股份有限公司
     
    [Languages]
    Name: "Chinese"; MessagesFile: "compiler:Default.isl"
     
    [Tasks]
    Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: checkablealone; OnlyBelowVersion: 0,8.1
    Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
     
    [Files]
    Source: "..OUTBinx64ReleaseSysZwGx_standardizeddrawing.exe"; DestDir: "{app}SysZw"; Flags: ignoreversion;  Permissions: authusers-full
    Source: "..OUTBinx64Release*.*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs; Permissions: authusers-full
    Source: "waterctrl.dll"; Flags: dontcopy 
    Source: "WizardImage.bmp"; Flags: dontcopy 
    ; 注意: 不要在任何共享系统文件上使用“Flags: ignoreversion”
     
    [Icons]
    Name: "{group}{#shortCutName}"; Filename: "{app}SysZw{#MyAppExeName}"
    Name: "{group}{cm:UninstallProgram,{#shortCutName}}"; Filename: "{uninstallexe}"
    Name: "{commondesktop}{#shortCutName}"; Filename: "{app}SysZw{#MyAppExeName}"; Tasks: desktopicon
    Name: "{userappdata}MicrosoftInternet ExplorerQuick Launch{#MyAppExeName}"; Filename: "{app}SysZw{#MyAppExeName}"; Tasks: quicklaunchicon
     
     
    [Run]
    Filename: "{app}SysZwvcredist_x86.exe"; Parameters: /q; WorkingDir: {tmp}; Flags: skipifdoesntexist;StatusMsg: "Installing Microsoft Visual C++ Runtime ..."; Check: NeedInstallVC9SP1
    ;Filename: "{app}SysZwAceRedist.msi"; Parameters: /q; WorkingDir: {tmp}; Flags: skipifdoesntexist; StatusMsg: "Installing Microsoft Access Database Engine 2010 Redistributable ...";
    Filename: "{app}SysZwmsiexec.exe"; Parameters: "/i ""{app}SysZwAceRedist.msi"" /quiet";StatusMsg:"Installing Microsoft Access Database Engine 2010 Redistributable ..."
    Filename: "{app}SysZw{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(shortCutName, "&", "&&")}}"; Flags: nowait postinstall skipifsilent
     
    [UninstallDelete]
    Name: {app}; Type: filesandordirs; 
     
    [code]
     var
     vc9SP1Missing: Boolean;
     vc9SP2Missing: Boolean;
     
    function InitializeSetup():boolean;
    var
     // MykeynotExist:boolean;
     //ResultCode: Integer;
     // uicmd: String;
      version: Cardinal;
     
    begin
      {检测是否安装vcredist_x86.exe}
      if RegQueryDWordValue(HKLM, 'SOFTWAREWow6432NodeMicrosoftWindowsCurrentVersionUninstall{196BB40D-1578-3D01-B289-BEFC77A11A1E}', 'Version', version) = false
     then
       begin
         vc9SP1Missing := true;
       end;
      
       
      //MykeynotExist:= true;
      //if RegQueryStringValue(HKLM, 'SOFTWAREMicrosoftWindowsCurrentVersionUninstall{904DF7AD-D92A-4E81-A8ED-F0EB51701FFC}_is1', 'UninstallString', uicmd) then
      //begin
        {MyKeynotExist:= false;
        Exec(RemoveQuotes(uicmd), '', '', SW_SHOW, ewWaitUntilTerminated, ResultCode); }
      //  ResultCode := MsgBox('检测到本机已安装其他版本!继续安装将会覆盖本机已安装版本!是否继续安装?', mbConfirmation, MB_YESNO);
      //  if  ResultCode = IDNO then
      //  begin
      //  MyKeynotExist:= false;
      //  end;
      //  if  ResultCode = IDYES then
      //  begin
          {Exec(RemoveQuotes(uicmd), '/silent /verysilent /suppressmsgboxes', '', SW_HIDE, ewWaitUntilTerminated, ResultCode);}
      //    MyKeynotExist:= true;
      //  end;
      //end;                                                                            
     // Result:= MykeynotExist
     
       Result:= true;
    end;
     
    function InitializeUninstall(): Boolean;
      begin
        Result:= true;
        if MsgBox('卸载将会清空安装目录,请确认已导出图元库!请确认已导出图元库!请确认已导出图元库!是否继续卸载?', mbConfirmation, MB_YESNO) = IDYES then
        begin
          Result:= true;
        end
        else
          Result:= false;
      end;
     
     
     
    function NeedInstallVC9SP1(): Boolean;
    begin
     Result := vc9SP1Missing;
    end;
     
    function NeedInstallVC9SP2(): Boolean;
    begin
     Result := vc9SP2Missing;
    end;
     
    {实现水波纹效果}
    function enablewater(ParentWnd: HWND; Left, Top: integer; Bmp: HBITMAP;
         WaterRadius, WaterHeight: integer): BOOL; external 'enablewater@files:waterctrl.dll stdcall';
    //ParentWnd     放置特效窗口的父窗口句柄。
    //Left          左位置
    //Top           上位置
    //Bmp           位图句柄。
    //WaterRadius   水纹半径,会令到水纹看起来范围更广。
    //WaterHeight   水纹高度,会令到水纹看起来更深。
    //注意,水纹插件自动根据图片来设定高度和宽度,
    //另外水纹底图必须是翻转的图片,显示的时候会翻转图片来显示。
     
    function waterblob(x, y: integer; radius, height: integer): BOOL; external 'waterblob@files:waterctrl.dll stdcall';
    // 在 x,y 点产生半径为radius, 高度为height 的水纹。
     
    function flattenwater(): BOOL; external 'flattenwater@files:waterctrl.dll stdcall';
    // 平伏所有水纹。
     
    function disablewater(): BOOL; external 'disablewater@files:waterctrl.dll stdcall';
    //释放水纹插件
     
    function setwaterparent(ParentWnd: HWND): BOOL; external 'setwaterparent@files:waterctrl.dll stdcall';
    //v2 新增,设置水纹插件的父句柄
     
    var
      bmp: TBitmap;
     
    procedure InitializeWizard();
    var
      LabelDate: Tlabel;
      uicmd: String;
    begin
      ExtractTemporaryFile('WizardImage.bmp');
      bmp := TBitmap.create;
      bmp.LoadFromFile(ExpandConstant('{tmp}WizardImage.bmp'));
     
      enablewater(WizardForm.WelcomePage.Handle, 0, 0, bmp.Handle, 3, 50);
     
      {欢迎页面添加文字}
      WizardForm.WelcomeLabel2.Autosize := true;
     
      LabelDate := Tlabel.Create(WizardForm);
     
      LabelDate.Autosize := true;
     
      LabelDate.Caption := '本程序由中望应用研发制作!'#10#13#10#13'了解更多ZWCAD信息请登录:https://www.zwcad.com/';
     
      if RegQueryStringValue(HKLM, 'SOFTWAREMicrosoftWindowsCurrentVersionUninstall{904DF7AD-D92A-4E81-A8ED-F0EB51701FFC}_is1', 'UninstallString', uicmd) then
      begin
         LabelDate.Font.Color := clred;    //修改文字颜色
         LabelDate.Caption := '检测到本机已安装其他版本,继续安装将会覆盖原版本!' #10#13#10#13'请确认已导出相关图元库!'
      end;
     
     
      LabelDate.Parent := WizardForm.WelcomePage;
     
      LabelDate.Left := WizardForm.WelcomeLabel2.Left;
     
      LabelDate.Top := WizardForm.WelcomeLabel2.Top +WizardForm.WelcomeLabel2.Height +80;
    end;
     
    procedure CurPageChanged(CurPageID: Integer);
    begin
      if CurPageID = wpWelcome then
      begin
        setwaterparent(WizardForm.WelcomePage.Handle);
        waterblob(70, 198, 10, 1000);
      end else
      if CurPageID = wpFinished then
      begin
        setwaterparent(WizardForm.FinishedPage.Handle);
        waterblob(70, 198, 10, 1000);
      end else
        flattenwater();
    end;
     
    procedure DeinitializeSetup();
    begin
      disablewater();
      bmp.Free;
    end;


    ————————————————
    版权声明:本文为CSDN博主「wang161019」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
    原文链接:https://blog.csdn.net/wang161019/article/details/91491300

  • 相关阅读:
    java中会存在内存泄漏吗,请简单描述?
    垃圾回收器的基本原理是什么?垃圾回收器可以马上回收内存吗?有什么办法主动通知虚拟机进行垃圾回收?
    SpringMvc的控制器是不是单例模式,如果是,有什么问题,怎么解决?
    SpringMVC怎么样设定重定向和转发的?
    Spring MVC的异常处理 ?
    如果前台有很多个参数传入,并且这些参数都是一个对象的,那么怎么样快速得到这个对象?
    Spring是什么?
    SpringMvc用什么对象从后台向前台传递数据的?
    SpringMvc中函数的返回值是什么?
    BeanFactory和ApplicationContext有什么区别?
  • 原文地址:https://www.cnblogs.com/eaglexmw/p/11473833.html
Copyright © 2011-2022 走看看