How to apply VCL Styles to DLL-based forms in Inno Setup for uninstall? Cannot Import dll

耗尽温柔 提交于 2019-12-08 08:19:24

问题


I'm trying to add VCL styles (Inno Setup 5.5.6 (a)) for my installer. Style load correctly during the installation, but when I try to uninstall I get an error

Runtime Error(at-1:0): Cannot Import dll:VclStylesInno.dll.

And I can not uninstall my program.

Does anyone know what I can do?
Thanks for the help

#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;

回答1:


You are not specifying a path to the uninstall copy of the VclStylesInno.dll.

This is the correct way:

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

Next time, just follow the official instructions for uninstalling the VCL Styles for Inno Setup.



来源:https://stackoverflow.com/questions/36745054/how-to-apply-vcl-styles-to-dll-based-forms-in-inno-setup-for-uninstall-cannot-i

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!