How to apply VCL Styles to DLL-based forms in Inno Setup?

前提是你 提交于 2019-12-24 00:49:30

问题


I'm using Inno Setup (Unicode) with a set of DLL's that I'm writing in Delphi XE2. The DLL's have VCL forms which are shown during the installation wizard/progress.

I've tried out implementing VCL Styles in my Inno Setup installer. All is well, except for the forms which are created within these DLL's. Some of the form is skinned, but not all of it...

As you can see, the form's background color, the list view background color, and the font color have changed. However, the list view headers, the progress bars, and the form's border are still the old style.

How can I make the forms in these DLL's show proper styles?


回答1:


The VCL Styles plugin for Inno Setup is only designed to draw styles on the forms and controls in Inno Setup. In order to get the forms in these DLL's to be skinned, you need to export a function from the DLL that Inno Setup can pass in the filename...

Inno Setup

[Code]
#define public VclStyleFile "Carbon (2).vsf"

procedure DllLoadStyle(const StyleFilename: WideString);
  external 'DllLoadStyle@MyDLL.dll stdcall';

function InitializeSetup: Boolean;
begin
  ExtractTemporaryFile('{#VclStyleFile}');
  LoadVCLStyleW(ExpandConstant('{tmp}\{#VclStyleFile}'));
  DllInit; //Presumed your DLL needs to initialize / instantiate the form
  DllLoadStyle(ExpandConstant('{tmp}\{#VclStyleFile}'));
  ...
end;

Delphi DLL

uses
  Vcl.Themes,

procedure DllLoadStyle(const StyleFilename: WideString); stdcall;
begin
  TStyleManager.SetStyle(TStyleManager.LoadFromFile(StyleFilename))
end;

exports
  DllLoadStyle;


来源:https://stackoverflow.com/questions/21805807/how-to-apply-vcl-styles-to-dll-based-forms-in-inno-setup

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