Search code examples
inno-setuppascalscriptvcl-stylesvcl-styles.-utils

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


I have a problem with loading VCL Styles for Inno Setup. The installer generates correctly, but still remains an old style. New styles will not load.

I do not understand why this is happening. Please help!

Here my iss code:

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

Solution

  • Just follow the VCL Styles sample script:

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

    Note the {tmp}\.

    You are not giving in a path to your style file, so the LoadVCLStyle fails, as it cannot find the file.