As Ghisler wrote clearly in the course of this thread, the upcoming version will support the Win 10 API functions for dark mode. And since he does it based on a Github sample for Win32 apps, the user is asking for a hint on how to do that on his own application. Quite legitimate, actually.
- Site Admin
- Posts: 38213
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
It's not easy. For some controls like listboxes, you can simply call
Others need to be owner drawn by yourself.
Also make sure to call AllowDarkModeForApp BEFORE opening any forms, otherwise context menus will be wrong.
But it's a LOT of work, I've been working on that for months now...
Here is how I load the special functions:
Code: Select all
type tIsDarkModeAllowedForApp=function:bool; stdcall; tShouldAppsUseDarkMode=function:integer; stdcall; // only bit 1! tAllowDarkModeForWindow= function(a_HWND:HWND;a_Allow:boolean):bool; stdcall; tAllowDarkModeForApp=function(mode:integer):bool; stdcall; var IsDarkModeAllowedForApp:tIsDarkModeAllowedForApp=nil; ShouldAppsUseDarkMode:tShouldAppsUseDarkMode=nil; AllowDarkModeForWindow:tAllowDarkModeForWindow=nil; AllowDarkModeForApp:tAllowDarkModeForApp=nil; IsDarkModeAllowedForApp:=GetProcAddress(themelib, MAKEINTRESOURCE(139)); ShouldAppsUseDarkMode:=GetProcAddress(themelib, MAKEINTRESOURCE(132)); AllowDarkModeForWindow:=GetProcAddress(themelib, MAKEINTRESOURCE(133)); AllowDarkModeForApp:=GetProcAddress(themelib, MAKEINTRESOURCE(135));
- Junior Member
- Posts: 15
- Joined: 2007-09-15, 14:53 UTC
- Location: Noord-Brabant, The Netherlands
I also found this Pascal example: https://www.haijin-boys.com/wiki/ダークモード対応
I can get the main menu items dark, but not the main menu itself. And I think it's strange you have to set the color of the forms yourself... Perhaps I'm doing something wrong.
Good luck with testing TC 9.5.