2

我正在尝试为我的安装程序添加 VCL 样式(Inno Setup 5.5.6 (a))。在安装过程中正确加载样式,但是当我尝试卸载时出现错误

运行时错误(at-1:0):无法导入 dll:VclStylesInno.dll。

而且我无法卸载我的程序。

有谁知道我能做什么?
谢谢您的帮助

#define VCLStylesSkinPath "{localappdata}\VCLStylesSkin"

[Files]
;Install
Source: "VclStylesinno.dll"; DestDir: "{app}"; Flags: dontcopy
Source: "Styles\Auric.vsf"; DestDir: "{app}"; Flags: dontcopy
;Uninstall
Source: "VclStylesinno.dll"; DestDir: "{#VCLStylesSkinPath}"; \
  Flags: uninsneveruninstall
Source: "Styles\Auric.vsf"; DestDir: "{#VCLStylesSkinPath}"; \
  Flags: uninsneveruninstall

[Code]

{ Import the LoadVCLStyle function from VclStylesInno.DLL }
procedure LoadVCLStyle(VClStyleFile: String);
  external 'LoadVCLStyleA@files:VclStylesInno.dll stdcall setuponly';
procedure LoadVCLStyle_UnInstall(VClStyleFile: String);
  external 'LoadVCLStyleA@VclStylesInno.dll stdcall uninstallonly';

{ Import the UnLoadVCLStyles function from VclStylesInno.DLL }
procedure UnLoadVCLStyles;
  external 'UnLoadVCLStyles@files:VclStylesInno.dll stdcall setuponly';
procedure UnLoadVCLStyles_UnInstall;
  external 'UnLoadVCLStyles@VclStylesInno.dll stdcall uninstallonly';
    
function InitializeUninstall: Boolean;
begin
  Result := True;
  LoadVCLStyle_UnInstall(ExpandConstant('Styles\Auric.vsf'));
end;

procedure DeinitializeUninstall();
begin
  UnLoadVCLStyles_UnInstall;
end;
4

1 回答 1

2

您没有指定VclStylesInno.dll.

这是正确的方法:

procedure LoadVCLStyle_UnInstall(VClStyleFile: String); 
  external 'LoadVCLStyleA@{#VCLStylesSkinPath}\VclStylesInno.dll stdcall uninstallonly';

下次,只需按照官方说明卸载 VCL Styles for Inno Setup 即可

有关更多详细信息,甚至可能是比官方解决方案更好的解决方案,另请参阅Load external DLL for uninstall process in Inno Setup

于 2016-04-20T13:43:21.200 回答