How about a dark GUI for TC?

English support forum

Moderators: sheep, Hacker, Stefan2, white

Post Reply
User avatar
MVV
Power Member
Power Member
Posts: 8397
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Re: How about a dark GUI for TC?

Post by *MVV » 2019-10-01, 06:57 UTC

Why do you ask here? TC doesn't use Windows 10 dark/light mode feature, it has own color settings...

User avatar
SSc
Junior Member
Junior Member
Posts: 33
Joined: 2015-10-27, 10:12 UTC
Location: Karlsruhe

Re: How about a dark GUI for TC?

Post by *SSc » 2019-10-01, 07:28 UTC

MVV wrote:
2019-10-01, 06:57 UTC
Why do you ask here? TC doesn't use Windows 10 dark/light mode feature, it has own color settings...
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.

User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 38213
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: How about a dark GUI for TC?

Post by *ghisler(Author) » 2019-10-03, 10:12 UTC

2Erik-DJ
It's not easy. For some controls like listboxes, you can simply call
SetWindowTheme(handle,'DarkMode_Explorer',nil);
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));
Author of Total Commander
http://www.ghisler.com

Erik-DJ
Junior Member
Junior Member
Posts: 15
Joined: 2007-09-15, 14:53 UTC
Location: Noord-Brabant, The Netherlands

Re: How about a dark GUI for TC?

Post by *Erik-DJ » 2019-10-09, 08:23 UTC

Thank you Christian, it's beginning to work in my project, but it's a lot of work indeed.
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.

Post Reply