salvadordf / CEF4Delphi

CEF4Delphi is an open source project to embed Chromium-based browsers in applications made with Delphi or Lazarus/FPC for Windows, Linux and MacOS.
https://www.briskbard.com/forum/
Other
1.19k stars 363 forks source link

Dpi crash on launch #484

Closed sebou77 closed 9 months ago

sebou77 commented 9 months ago

Hi, here's my problem i code on delphi 10.3, with 4k screen (150% on windows scale). When i launch my app without cef no problem, and when i add :

CreateGlobalCEFApp; if GlobalCEFApp.StartMainProcess then

my app juste become crazy on 150% windows scale (TImage on alClient take 25% of size, popupmenu appear at random place, etc..), it's keep working on 100% windows scale. Any idea ?

salvadordf commented 9 months ago

Hi,

CEF had some issues with the DPI awareness setting as you can see here.

I upgraded my Delphi installation to 11.3 and I can't test the workarounds suggested in that link with Delphi 10.3.

Open the project settings and click on the "Application -> Manifest" section. Try setting "DPI Awareness" to "None".

Other DPI Awareness values might work too but I can't test them.

Please, post this information in our forum if this workaround doesn't work for your application.

salvadordf commented 8 months ago

Adding a manifest with some value for DPI awareness or calling SetProcessDpiAwareness() with the value PROCESS_DPI_UNAWARE before loading the CEF works. See this question in stackoverflow.