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:\GitHub\SVN\Project\ZwRQY\ZWRQY_ZWCAD\license.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 = .\Setup\Setup\res\zwcad.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: "..\OUT\Bin\x64\Release\SysZw\Gx_standardizeddrawing.exe"; DestDir: "{app}\SysZw"; Flags: ignoreversion;  Permissions: authusers-full
Source: "..\OUT\Bin\x64\Release\*.*"; 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}\Microsoft\Internet Explorer\Quick Launch\{#MyAppExeName}"; Filename: "{app}\SysZw\{#MyAppExeName}"; Tasks: quicklaunchicon


[Run]
Filename: "{app}\SysZw\vcredist_x86.exe"; Parameters: /q; WorkingDir: {tmp}; Flags: skipifdoesntexist;StatusMsg: "Installing Microsoft Visual C++ Runtime ..."; Check: NeedInstallVC9SP1
;Filename: "{app}\SysZw\AceRedist.msi"; Parameters: /q; WorkingDir: {tmp}; Flags: skipifdoesntexist; StatusMsg: "Installing Microsoft Access Database Engine 2010 Redistributable ...";
Filename: "{app}\SysZw\msiexec.exe"; Parameters: "/i ""{app}\SysZw\AceRedist.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, 'SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{196BB40D-1578-3D01-B289-BEFC77A11A1E}', 'Version', version) = false
 then
   begin
     vc9SP1Missing := true;
   end;
  
   
  //MykeynotExist:= true;
  //if RegQueryStringValue(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{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, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{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;

 

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Finn Wang

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值