如何在 Inno Setup 中将 VCL 样式应用于基于 DLL 的表单?新样式不会加载

How to apply VCL Styles to DLL-based forms in Inno Setup? New styles will not load

我在为 Inno Setup 加载 VCL 样式时遇到问题。安装程序正确生成,但仍然是旧样式。新样式将不会加载。

我不明白为什么会这样。请帮忙!

这是我的 iss 代码:

[Files]
...
; add library to create new styles
Source: "VclStylesinno.dll"; DestDir: {app}; Flags: dontcopy
Source: "Styles/Pink.vsf"; DestDir: {app}; Flags: dontcopy

[Code]

// Import the LoadVCLStyle function from VclStylesInno.DLL
procedure LoadVCLStyle(VClStyleFile: String);
  external 'LoadVCLStyleW@files:VclStylesInno.dll stdcall';
// Import the UnLoadVCLStyles function from VclStylesInno.DLL
procedure UnLoadVCLStyles;
  external 'UnLoadVCLStyles@files:VclStylesInno.dll stdcall';

function InitializeSetup(): Boolean;
begin
   ExtractTemporaryFile('Pink.vsf');
   LoadVCLStyle(ExpandConstant('Pink.vsf'));
   Result := True;
end;

只需关注 VCL Styles sample script:

function InitializeSetup(): Boolean;
begin
  ExtractTemporaryFile('Amakrits.vsf');
  LoadVCLStyle(ExpandConstant('{tmp}\Amakrits.vsf'));
  Result := True;
end;

注意 {tmp}\

您没有提供样式文件的路径,因此 LoadVCLStyle 失败,因为它找不到该文件。