1

We have a Delphi project which is DPI-aware. We've achieved this, amongst other things, by including a manifest in the executable. This all works fine, the project scales nicely according to the DPI settings.

Recently we've begun translating our product, for which we are using Sisulizer. This tool has been configured to generate a resource DLL. The manifest is copied to the resource DLL by Sisulizer but is not translated. So the translations are working fine too :)

However, the translated project is no longer fully DPI-aware. MessageBoxes (from the Windows API) are still DPI-aware but the rest of the project no longer scales. The untranslated project is still DPI-aware.

Martin
  • 21
  • 1
  • 4
  • 2
    Is the manifest still in the EXE's resources? Or was it removed from the EXE and moved to the DLL? Also, make sure that the manifest's resource ID is 1 when in the EXE's resources and 2 when in the DLL's resources. – Remy Lebeau Sep 10 '20 at 19:00
  • The loader won't activate a manifest in a dll. You'd have to do that. – David Heffernan Sep 10 '20 at 21:01
  • Thanks, Remy! The manifest is in both the EXE and DLL. I tried changing the resource ID in the DLL but it didn't change the behaviour. – Martin Sep 11 '20 at 07:06
  • @David: thanks for the comment! That would indeed explain a lot. Do you have any pointers on how to accomplish that from Delphi? – Martin Sep 11 '20 at 11:49
  • You use the activation context API. `ActivateActCtx` and friends. One thing in your favour is that the loaded does activate the context associated with DLLs manifest in the call to DllMain when the DLL is loaded, so you can capture it there with `GetCurrentActCtx`. – David Heffernan Sep 11 '20 at 12:09

1 Answers1

1

Issue has been resolved. The manifest was not the problem, it was an option in the Sisulizer-project: "Form scaling" was set to "Disable scaling", which caused the dfm to be changed in the resource DLL ("Scaled=False" was added). Changing it to "Ignore" resolved the issue.

When changing language from the GUI (so Screen.FormCount > 0) the scaling was not automatically set to the correct DPI. Or in other words: the forms are streamed from the resource DLL in their design-time state. We have fixed this by recording the scale factor for each form prior to switching to another language. Once the language has been changed (and all the forms have been translated) we re-apply the scale factor to the forms so everything shows up as expected.

Martin
  • 21
  • 1
  • 4