-
Jun 22nd, 2023, 08:09 PM
#1
Thread Starter
Hyperactive Member
Windows 10 Dark Mode & VB6 apps
VB6SP6, VBCCR17, Win10 (latest) & Dark Mode acitvated
Does anybody know how to activate the windows 10 dark mode for an vb6-app?
I already set the background color of the app window myself and change the background color of the most controls but i dont know how change the color of the window title bar or the scrollbars.
I guess there must be some windows theme API that can activate the dark mode for the window and maybe the controls too?
-
Jun 22nd, 2023, 09:43 PM
#2
Re: Windows 10 Dark Mode & VB6 apps
That Dark Mode has limited support outside of Metro/WinRT/UWP "Store Apps." A few other things like File Explorer and Edge support it, but I don't think the APIs for that were ever published.
-
Jun 23rd, 2023, 12:21 AM
#3
Re: Windows 10 Dark Mode & VB6 apps
For the title bar, try this:
Code:
Public Declare Function DwmSetWindowAttribute Lib "uxtheme" (ByVal hWnd As Long, ByVal dwAttribute As Long, pvAttribute As Any, ByVal cbAttribute As Long) As Long
Const DWMWA_USE_IMMERSIVE_DARK_MODE = 20
Dim bValue As Long: bValue = 1
DwmSetWindowAttribute hWnd, DWMWA_USE_IMMERSIVE_DARK_MODE, bValue, LenB(bValue)
or this:
Code:
Public Declare Function SetWindowCompositionAttribute Lib "user32" (ByVal hWnd As Long, wca As WINDOWCOMPOSITIONATTRIBDATA) As Long
Public Type WINDOWCOMPOSITIONATTRIBDATA
Attrib As WINDOWCOMPOSITIONATTRIB
pvData As Long
cbData As Long
End Type
Const WCA_USEDARKMODECOLORS=26
Dim tWCAD As WINDOWCOMPOSITIONATTRIBDATA
Dim bValue As Long: bValue = 1
tWCAD.Attrib = WCA_USEDARKMODECOLORS
tWCAD.pvData = VarPtr(bValue)
tWCAD.cbData = LenB(bValue)
SetWindowCompositionAttribute hWnd, tWCAD
Scroll bars look harder... this might help.
-
Jun 23rd, 2023, 05:52 AM
#4
Thread Starter
Hyperactive Member
Re: Windows 10 Dark Mode & VB6 apps
[QUOTE]
Code:
Public Declare Function DwmSetWindowAttribute Lib "uxtheme" (ByVal hWnd As Long, ByVal dwAttribute As Long, pvAttribute As Any, ByVal cbAttribute As Long) As Long
i get the error "Entry point not found" with this API declaration...
Code:
Public Type WINDOWCOMPOSITIONATTRIBDATA
Attrib As WINDOWCOMPOSITIONATTRIB
pvData As Long
cbData As Long
End Type
The line "Attrib As WINDOWCOMPOSITIONATTRIB" throws the error "user-defined type not defined"...
-
Jun 23rd, 2023, 06:11 AM
#5
Thread Starter
Hyperactive Member
Re: Windows 10 Dark Mode & VB6 apps
@fafalone
i used this modified code from your #1 example but it doesnt change the title bar of the form:
Code:
Private Declare Function DwmSetWindowAttribute Lib "dwmapi.dll" (ByVal hWnd As Long, ByVal dwAttribute As Long, ByRef pvAttribute As Long, ByVal cbAttribute As Long) As Long
Private Const DWMWA_USE_IMMERSIVE_DARK_MODE = 20
Private Sub Form_Load()
Dim bValue As Long
bValue = 1
Call DwmSetWindowAttribute(Me.hWnd, DWMWA_USE_IMMERSIVE_DARK_MODE, bValue, LenB(bValue))
End Sub
i also tried this modified code from your #2 example but the title bar of the form doesnt change too:
Code:
Public Declare Function SetWindowCompositionAttribute Lib "user32" (ByVal hWnd As Long, wca As WINDOWCOMPOSITIONATTRIBDATA) As Long
Private Enum WINDOWCOMPOSITIONATTRIB
WCA_UNDEFINED = 0
WCA_NCRENDERING_ENABLED = 1
WCA_NCRENDERING_POLICY = 2
WCA_TRANSITIONS_FORCEDISABLED = 3
WCA_ALLOW_NCPAINT = 4
WCA_CAPTION_BUTTON_BOUNDS = 5
WCA_NONCLIENT_RTL_LAYOUT = 6
WCA_FORCE_ICONIC_REPRESENTATION = 7
WCA_EXTENDED_FRAME_BOUNDS = 8
WCA_HAS_ICONIC_BITMAP = 9
WCA_THEME_ATTRIBUTES = 10
WCA_NCRENDERING_EXILED = 11
WCA_NCADORNMENTINFO = 12
WCA_EXCLUDED_FROM_LIVEPREVIEW = 13
WCA_VIDEO_OVERLAY_ACTIVE = 14
WCA_FORCE_ACTIVEWINDOW_APPEARANCE = 15
WCA_DISALLOW_PEEK = 16
WCA_CLOAK = 17
WCA_CLOAKED = 18
WCA_ACCENT_POLICY = 19
WCA_FREEZE_REPRESENTATION = 20
WCA_EVER_UNCLOAKED = 21
WCA_VISUAL_OWNER = 22
WCA_LAST = 23
End Enum
Private Type WINDOWCOMPOSITIONATTRIBDATA
Attrib As WINDOWCOMPOSITIONATTRIB
pvData As Long
cbData As Long
End Type
Const WCA_USEDARKMODECOLORS = 26
Private Sub Form_Load()
Dim tWCAD As WINDOWCOMPOSITIONATTRIBDATA
Dim bValue As Long
bValue = 1
tWCAD.Attrib = WCA_USEDARKMODECOLORS
tWCAD.pvData = VarPtr(bValue)
tWCAD.cbData = LenB(bValue)
SetWindowCompositionAttribute Me.hWnd, tWCAD
End Sub
i tried both examples in the VB6 IDE and as a compilied exe.
The Win10 dark mode was activated when running the tests.
any ideas or suggestions?
-
Jun 23rd, 2023, 06:18 AM
#6
Thread Starter
Hyperactive Member
Re: Windows 10 Dark Mode & VB6 apps
 Originally Posted by dilettante
That Dark Mode has limited support outside of Metro/WinRT/UWP "Store Apps." A few other things like File Explorer and Edge support it, but I don't think the APIs for that were ever published.
I found a Github project that enables Dark Mode support for win32 apps but i dont know how to convert the used APIs into VB6 language:
https://github.com/komiyamma/win32-darkmode
Code:
#pragma once
#include "IatHook.h"
enum IMMERSIVE_HC_CACHE_MODE
{
IHCM_USE_CACHED_VALUE,
IHCM_REFRESH
};
// 1903 18362
enum PreferredAppMode
{
Default,
AllowDark,
ForceDark,
ForceLight,
Max
};
enum WINDOWCOMPOSITIONATTRIB
{
WCA_UNDEFINED = 0,
WCA_NCRENDERING_ENABLED = 1,
WCA_NCRENDERING_POLICY = 2,
WCA_TRANSITIONS_FORCEDISABLED = 3,
WCA_ALLOW_NCPAINT = 4,
WCA_CAPTION_BUTTON_BOUNDS = 5,
WCA_NONCLIENT_RTL_LAYOUT = 6,
WCA_FORCE_ICONIC_REPRESENTATION = 7,
WCA_EXTENDED_FRAME_BOUNDS = 8,
WCA_HAS_ICONIC_BITMAP = 9,
WCA_THEME_ATTRIBUTES = 10,
WCA_NCRENDERING_EXILED = 11,
WCA_NCADORNMENTINFO = 12,
WCA_EXCLUDED_FROM_LIVEPREVIEW = 13,
WCA_VIDEO_OVERLAY_ACTIVE = 14,
WCA_FORCE_ACTIVEWINDOW_APPEARANCE = 15,
WCA_DISALLOW_PEEK = 16,
WCA_CLOAK = 17,
WCA_CLOAKED = 18,
WCA_ACCENT_POLICY = 19,
WCA_FREEZE_REPRESENTATION = 20,
WCA_EVER_UNCLOAKED = 21,
WCA_VISUAL_OWNER = 22,
WCA_HOLOGRAPHIC = 23,
WCA_EXCLUDED_FROM_DDA = 24,
WCA_PASSIVEUPDATEMODE = 25,
WCA_USEDARKMODECOLORS = 26,
WCA_LAST = 27
};
struct WINDOWCOMPOSITIONATTRIBDATA
{
WINDOWCOMPOSITIONATTRIB Attrib;
PVOID pvData;
SIZE_T cbData;
};
using fnRtlGetNtVersionNumbers = void (WINAPI *)(LPDWORD major, LPDWORD minor, LPDWORD build);
using fnSetWindowCompositionAttribute = BOOL (WINAPI *)(HWND hWnd, WINDOWCOMPOSITIONATTRIBDATA*);
// 1809 17763
using fnShouldAppsUseDarkMode = bool (WINAPI *)(); // ordinal 132
using fnAllowDarkModeForWindow = bool (WINAPI *)(HWND hWnd, bool allow); // ordinal 133
using fnAllowDarkModeForApp = bool (WINAPI *)(bool allow); // ordinal 135, in 1809
using fnFlushMenuThemes = void (WINAPI *)(); // ordinal 136
using fnRefreshImmersiveColorPolicyState = void (WINAPI *)(); // ordinal 104
using fnIsDarkModeAllowedForWindow = bool (WINAPI *)(HWND hWnd); // ordinal 137
using fnGetIsImmersiveColorUsingHighContrast = bool (WINAPI *)(IMMERSIVE_HC_CACHE_MODE mode); // ordinal 106
using fnOpenNcThemeData = HTHEME(WINAPI *)(HWND hWnd, LPCWSTR pszClassList); // ordinal 49
// 1903 18362
using fnShouldSystemUseDarkMode = bool (WINAPI *)(); // ordinal 138
using fnSetPreferredAppMode = PreferredAppMode (WINAPI *)(PreferredAppMode appMode); // ordinal 135, in 1903
using fnIsDarkModeAllowedForApp = bool (WINAPI *)(); // ordinal 139
fnSetWindowCompositionAttribute _SetWindowCompositionAttribute = nullptr;
fnShouldAppsUseDarkMode _ShouldAppsUseDarkMode = nullptr;
fnAllowDarkModeForWindow _AllowDarkModeForWindow = nullptr;
fnAllowDarkModeForApp _AllowDarkModeForApp = nullptr;
fnFlushMenuThemes _FlushMenuThemes = nullptr;
fnRefreshImmersiveColorPolicyState _RefreshImmersiveColorPolicyState = nullptr;
fnIsDarkModeAllowedForWindow _IsDarkModeAllowedForWindow = nullptr;
fnGetIsImmersiveColorUsingHighContrast _GetIsImmersiveColorUsingHighContrast = nullptr;
fnOpenNcThemeData _OpenNcThemeData = nullptr;
// 1903 18362
fnShouldSystemUseDarkMode _ShouldSystemUseDarkMode = nullptr;
fnSetPreferredAppMode _SetPreferredAppMode = nullptr;
bool g_darkModeSupported = false;
bool g_darkModeEnabled = false;
DWORD g_buildNumber = 0;
bool AllowDarkModeForWindow(HWND hWnd, bool allow)
{
if (g_darkModeSupported)
return _AllowDarkModeForWindow(hWnd, allow);
return false;
}
bool IsHighContrast()
{
HIGHCONTRASTW highContrast = { sizeof(highContrast) };
if (SystemParametersInfoW(SPI_GETHIGHCONTRAST, sizeof(highContrast), &highContrast, FALSE))
return highContrast.dwFlags & HCF_HIGHCONTRASTON;
return false;
}
void RefreshTitleBarThemeColor(HWND hWnd)
{
BOOL dark = FALSE;
if (_IsDarkModeAllowedForWindow(hWnd) &&
_ShouldAppsUseDarkMode() &&
!IsHighContrast())
{
dark = TRUE;
}
if (g_buildNumber < 18362)
SetPropW(hWnd, L"UseImmersiveDarkModeColors", reinterpret_cast<HANDLE>(static_cast<INT_PTR>(dark)));
else if (_SetWindowCompositionAttribute)
{
WINDOWCOMPOSITIONATTRIBDATA data = { WCA_USEDARKMODECOLORS, &dark, sizeof(dark) };
_SetWindowCompositionAttribute(hWnd, &data);
}
}
bool IsColorSchemeChangeMessage(LPARAM lParam)
{
bool is = false;
if (lParam && CompareStringOrdinal(reinterpret_cast<LPCWCH>(lParam), -1, L"ImmersiveColorSet", -1, TRUE) == CSTR_EQUAL)
{
_RefreshImmersiveColorPolicyState();
is = true;
}
_GetIsImmersiveColorUsingHighContrast(IHCM_REFRESH);
return is;
}
bool IsColorSchemeChangeMessage(UINT message, LPARAM lParam)
{
if (message == WM_SETTINGCHANGE)
return IsColorSchemeChangeMessage(lParam);
return false;
}
void AllowDarkModeForApp(bool allow)
{
if (_AllowDarkModeForApp)
_AllowDarkModeForApp(allow);
else if (_SetPreferredAppMode)
_SetPreferredAppMode(allow ? AllowDark : Default);
}
void FixDarkScrollBar()
{
HMODULE hComctl = LoadLibraryExW(L"comctl32.dll", nullptr, LOAD_LIBRARY_SEARCH_SYSTEM32);
if (hComctl)
{
auto addr = FindDelayLoadThunkInModule(hComctl, "uxtheme.dll", 49); // OpenNcThemeData
if (addr)
{
DWORD oldProtect;
if (VirtualProtect(addr, sizeof(IMAGE_THUNK_DATA), PAGE_READWRITE, &oldProtect))
{
auto MyOpenThemeData = [](HWND hWnd, LPCWSTR classList) -> HTHEME {
if (wcscmp(classList, L"ScrollBar") == 0)
{
hWnd = nullptr;
classList = L"Explorer::ScrollBar";
}
return _OpenNcThemeData(hWnd, classList);
};
addr->u1.Function = reinterpret_cast<ULONG_PTR>(static_cast<fnOpenNcThemeData>(MyOpenThemeData));
VirtualProtect(addr, sizeof(IMAGE_THUNK_DATA), oldProtect, &oldProtect);
}
}
}
}
constexpr bool CheckBuildNumber(DWORD buildNumber)
{
return (buildNumber == 17763 || // 1809
buildNumber == 18362 || // 1903
buildNumber == 18363 || // 1909
buildNumber == 19041 || // 2004
buildNumber >= 19042); // over 2009
}
void InitDarkMode()
{
auto RtlGetNtVersionNumbers = reinterpret_cast<fnRtlGetNtVersionNumbers>(GetProcAddress(GetModuleHandleW(L"ntdll.dll"), "RtlGetNtVersionNumbers"));
if (RtlGetNtVersionNumbers)
{
DWORD major, minor;
RtlGetNtVersionNumbers(&major, &minor, &g_buildNumber);
g_buildNumber &= ~0xF0000000;
if (major >= 10 && CheckBuildNumber(g_buildNumber))
{
HMODULE hUxtheme = LoadLibraryExW(L"uxtheme.dll", nullptr, LOAD_LIBRARY_SEARCH_SYSTEM32);
if (hUxtheme)
{
_OpenNcThemeData = reinterpret_cast<fnOpenNcThemeData>(GetProcAddress(hUxtheme, MAKEINTRESOURCEA(49)));
_RefreshImmersiveColorPolicyState = reinterpret_cast<fnRefreshImmersiveColorPolicyState>(GetProcAddress(hUxtheme, MAKEINTRESOURCEA(104)));
_GetIsImmersiveColorUsingHighContrast = reinterpret_cast<fnGetIsImmersiveColorUsingHighContrast>(GetProcAddress(hUxtheme, MAKEINTRESOURCEA(106)));
_ShouldAppsUseDarkMode = reinterpret_cast<fnShouldAppsUseDarkMode>(GetProcAddress(hUxtheme, MAKEINTRESOURCEA(132)));
_AllowDarkModeForWindow = reinterpret_cast<fnAllowDarkModeForWindow>(GetProcAddress(hUxtheme, MAKEINTRESOURCEA(133)));
auto ord135 = GetProcAddress(hUxtheme, MAKEINTRESOURCEA(135));
if (g_buildNumber < 18362)
_AllowDarkModeForApp = reinterpret_cast<fnAllowDarkModeForApp>(ord135);
else
_SetPreferredAppMode = reinterpret_cast<fnSetPreferredAppMode>(ord135);
//_FlushMenuThemes = reinterpret_cast<fnFlushMenuThemes>(GetProcAddress(hUxtheme, MAKEINTRESOURCEA(136)));
_IsDarkModeAllowedForWindow = reinterpret_cast<fnIsDarkModeAllowedForWindow>(GetProcAddress(hUxtheme, MAKEINTRESOURCEA(137)));
_SetWindowCompositionAttribute = reinterpret_cast<fnSetWindowCompositionAttribute>(GetProcAddress(GetModuleHandleW(L"user32.dll"), "SetWindowCompositionAttribute"));
if (_OpenNcThemeData &&
_RefreshImmersiveColorPolicyState &&
_ShouldAppsUseDarkMode &&
_AllowDarkModeForWindow &&
(_AllowDarkModeForApp || _SetPreferredAppMode) &&
//_FlushMenuThemes &&
_IsDarkModeAllowedForWindow)
{
g_darkModeSupported = true;
AllowDarkModeForApp(true);
_RefreshImmersiveColorPolicyState();
g_darkModeEnabled = _ShouldAppsUseDarkMode() && !IsHighContrast();
FixDarkScrollBar();
}
}
}
}
}
-
Jun 23rd, 2023, 07:04 PM
#7
Re: Windows 10 Dark Mode & VB6 apps
Yeah that project is where I got the 2nd call from... that's what it's doing in RefreshTitleBarThemeColor. You could try that SetProp call too...
Code:
Public Declare Function SetPropW Lib "user32" (ByVal hWnd As Long, ByVal lpString As Long, Optional ByVal hData As Long) As BOOL
Dim bValue As Long: bValue = 1
SetPropW hWnd, StrPtr("UseImmersiveDarkModeColors"), VarPtr(bValue)
It looks like you also need to set the theme to Explorer with SetWindowTheme...
Public Declare Function SetWindowTheme Lib "uxtheme" (ByVal hwnd As Long, ByVal pszSubAppName As Long, ByVal pszSubIdList As Long) As Long
SetWindowTheme hWnd, StrPtr("Explorer"), StrPtr("")
And this thread suggests DWMWA_USE_IMMERSIVE_DARK_MODE should be 19 if your Windows 10 version is earlier than 20H1.
Here's the complete enum, sorry I forgot to include it:
Code:
Public Enum WINDOWCOMPOSITIONATTRIB
WCA_UNDEFINED=0
WCA_NCRENDERING_ENABLED=1
WCA_NCRENDERING_POLICY=2
WCA_TRANSITIONS_FORCEDISABLED=3
WCA_ALLOW_NCPAINT=4
WCA_CAPTION_BUTTON_BOUNDS=5
WCA_NONCLIENT_RTL_LAYOUT=6
WCA_FORCE_ICONIC_REPRESENTATION=7
WCA_EXTENDED_FRAME_BOUNDS=8
WCA_HAS_ICONIC_BITMAP=9
WCA_THEME_ATTRIBUTES=10
WCA_NCRENDERING_EXILED=11
WCA_NCADORNMENTINFO=12
WCA_EXCLUDED_FROM_LIVEPREVIEW=13
WCA_VIDEO_OVERLAY_ACTIVE=14
WCA_FORCE_ACTIVEWINDOW_APPEARANCE=15
WCA_DISALLOW_PEEK=16
WCA_CLOAK=17
WCA_CLOAKED=18
WCA_ACCENT_POLICY=19
WCA_FREEZE_REPRESENTATION=20
WCA_EVER_UNCLOAKED=21
WCA_VISUAL_OWNER=22
WCA_HOLOGRAPHIC=23
WCA_EXCLUDED_FROM_DDA=24
WCA_PASSIVEUPDATEMODE=25
WCA_USEDARKMODECOLORS=26
WCA_CORNER_STYLE=27
WCA_PART_COLOR=28
WCA_DISABLE_MOVESIZE_FEEDBACK=29
WCA_LAST=30
End Enum
As to the entry point, that's weird... it's a documented function Microsoft says appears both in both uxtheme and dwmapi.
-
Jun 24th, 2023, 05:31 AM
#8
Thread Starter
Hyperactive Member
Re: Windows 10 Dark Mode & VB6 apps
Windows 10 Pro 22H2 (19045.2965), Dark Mode enabled
I tried SetWindowTheme+SetPropW and SetPropW alone but still no dark mode for the vb6 window...
I guess we cant just pick some random APIs from the win32-code and get the dark mode for our beloved vb6.
I think without translating the complete win32-code to VB6 it will not work.
Do you know someone can translate the code to VB6?
-
Jun 24th, 2023, 06:26 AM
#9
Re: Windows 10 Dark Mode & VB6 apps
It's not picking random APIs it's following the APIs of the examples where others have done this like the two examples linked in this thread. They're both making these same calls. The challenge is to figure out the precise difference that's making it work for them. SetPreferredAppMode perhaps?
It's straightforward enough to translate... you don't need LoadLibrary to get those functions, just use Declare with an alias for the ordinal.
The problematic one is the IAT hook for the scrollbars, you'd need to look at the VB6 examples for that and apply the concept.
-
Jun 25th, 2023, 01:16 AM
#10
Thread Starter
Hyperactive Member
Re: Windows 10 Dark Mode & VB6 apps
i translated the win32-code of the Github Dark Mode project.
I just didn't translate the code for the scrollbars.
Guess what, still no dark mode...
Can you test & review the translation?
Code:
Option Explicit
' https://github.com/komiyamma/win32-darkmode/blob/master/win32-darkmode/DarkMode.h
Const WCA_USEDARKMODECOLORS = 26
Const SPI_GETHIGHCONTRAST = 66
Const HCF_HIGHCONTRASTON As Integer = 1
Private Type HIGHCONTRAST
cbSize As Long
dwFlags As Long
lpszDefaultScheme As String
End Type
Private Enum IMMERSIVE_HC_CACHE_MODE
IHCM_USE_CACHED_VALUE = 0
IHCM_REFRESH = 1
End Enum
Private Enum PreferredAppMode
Default = 0
AllowDark = 1
ForceDark = 2
ForceLight = 3
Max = 4
End Enum
Private Enum WINDOWCOMPOSITIONATTRIB
WCA_UNDEFINED = 0
WCA_NCRENDERING_ENABLED = 1
WCA_NCRENDERING_POLICY = 2
WCA_TRANSITIONS_FORCEDISABLED = 3
WCA_ALLOW_NCPAINT = 4
WCA_CAPTION_BUTTON_BOUNDS = 5
WCA_NONCLIENT_RTL_LAYOUT = 6
WCA_FORCE_ICONIC_REPRESENTATION = 7
WCA_EXTENDED_FRAME_BOUNDS = 8
WCA_HAS_ICONIC_BITMAP = 9
WCA_THEME_ATTRIBUTES = 10
WCA_NCRENDERING_EXILED = 11
WCA_NCADORNMENTINFO = 12
WCA_EXCLUDED_FROM_LIVEPREVIEW = 13
WCA_VIDEO_OVERLAY_ACTIVE = 14
WCA_FORCE_ACTIVEWINDOW_APPEARANCE = 15
WCA_DISALLOW_PEEK = 16
WCA_CLOAK = 17
WCA_CLOAKED = 18
WCA_ACCENT_POLICY = 19
WCA_FREEZE_REPRESENTATION = 20
WCA_EVER_UNCLOAKED = 21
WCA_VISUAL_OWNER = 22
WCA_LAST = 23
End Enum
Private Type WINDOWCOMPOSITIONATTRIBDATA
Attrib As WINDOWCOMPOSITIONATTRIB
pvData As Long
cbData As Long
End Type
Private Declare Sub RtlGetNtVersionNumbers Lib "NTDLL.DLL" (major As Long, minor As Long, Build As Long)
Private Declare Function SetWindowCompositionAttribute Lib "user32" (ByVal HWND As Long, wca As WINDOWCOMPOSITIONATTRIBDATA) As Long
' 1809 17763
Private Declare Function ShouldAppsUseDarkMode Lib "uxtheme.dll" Alias "#132" () As Boolean
Private Declare Function AllowDarkModeForWindow Lib "uxtheme.dll" Alias "#133" (HWND As Long, allow As Boolean) As Boolean
Private Declare Function AllowDarkModeForApp Lib "uxtheme.dll" Alias "#135" (allow As Boolean) As Boolean
Private Declare Function FlushMenuThemes Lib "uxtheme.dll" Alias "#136" ()
Private Declare Function RefreshImmersiveColorPolicyState Lib "uxtheme.dll" Alias "#104" () As Boolean
Private Declare Function IsDarkModeAllowedForWindow Lib "uxtheme.dll" Alias "#137" (HWND As Long) As Boolean
Private Declare Function GetIsImmersiveColorUsingHighContrast Lib "uxtheme.dll" Alias "#106" (mode As IMMERSIVE_HC_CACHE_MODE) As Long
Private Declare Function OpenNcThemeData Lib "uxtheme.dll" Alias "#49" (HWND As Long, pszClassList As Long) As Long
' 1903 18362
Private Declare Function fnShouldSystemUseDarkMode Lib "uxtheme.dll" Alias "#138" () As Boolean
Private Declare Function SetPreferredAppMode Lib "uxtheme.dll" Alias "#135" (appMode As PreferredAppMode) As PreferredAppMode
Private Declare Function IsDarkModeAllowedForApp Lib "uxtheme.dll" Alias "#139" () As Boolean
' others
Private Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" ( _
ByVal uAction As Long, _
ByVal uParam As Long, _
ByRef lpvParam As Any, _
ByVal fuWinIni As Long) As Long
Private Declare Function SetPropW Lib "user32" (ByVal HWND As Long, ByVal lpString As Long, Optional ByVal hData As Long) As Boolean
Public g_darkModeSupported As Boolean
Public g_darkModeEnabled As Boolean
Dim g_buildNumber As Long
Private Function fnAllowDarkModeForWindow(ByRef HWND As Long, ByRef allow As Boolean) As Boolean
'bool AllowDarkModeForWindow(HWND hWnd, bool allow)
'{
' if (g_darkModeSupported)
' return _AllowDarkModeForWindow(hWnd, allow);
' return false;
'}
If g_darkModeSupported = True Then
fnAllowDarkModeForWindow = AllowDarkModeForWindow(HWND, allow)
Else
fnAllowDarkModeForWindow = False
End If
End Function
Private Function IsHighContrast() As Boolean
'bool IsHighContrast()
'{
' HIGHCONTRASTW highContrast = { sizeof(highContrast) };
' if (SystemParametersInfoW(SPI_GETHIGHCONTRAST, sizeof(highContrast), &highContrast, FALSE))
' return highContrast.dwFlags & HCF_HIGHCONTRASTON;
' return false;
'}
Dim high_Contrast As HIGHCONTRAST
If SystemParametersInfo(SPI_GETHIGHCONTRAST, LenB(high_Contrast), high_Contrast, 0) Then
IsHighContrast = high_Contrast.dwFlags Or HCF_HIGHCONTRASTON
Else
IsHighContrast = False
End If
End Function
Private Sub RefreshTitleBarThemeColor(ByRef HWND As Long)
'void RefreshTitleBarThemeColor(HWND hWnd)
'{
' BOOL dark = FALSE;
' if (_IsDarkModeAllowedForWindow(hWnd) &&
' _ShouldAppsUseDarkMode() &&
' !IsHighContrast())
' {
' dark = TRUE;
' }
' if (g_buildNumber < 18362)
' SetPropW(hWnd, L"UseImmersiveDarkModeColors", reinterpret_cast<HANDLE>(static_cast<INT_PTR>(dark)));
' else if (_SetWindowCompositionAttribute)
' {
' WINDOWCOMPOSITIONATTRIBDATA data = { WCA_USEDARKMODECOLORS, &dark, sizeof(dark) };
' _SetWindowCompositionAttribute(hWnd, &data);
' }
'}
Dim dark As Boolean
Dim bPropValue As Long
Dim bCompValue As Long
Dim tWCAD As WINDOWCOMPOSITIONATTRIBDATA
dark = False
bPropValue = 1
bCompValue = 1
If IsDarkModeAllowedForWindow(HWND) = True And ShouldAppsUseDarkMode = True And IsHighContrast = False Then
dark = True
End If
If g_buildNumber < 18362 Then
Call SetPropW(HWND, StrPtr("UseImmersiveDarkModeColors"), VarPtr(bPropValue))
Else
tWCAD.Attrib = WCA_USEDARKMODECOLORS
tWCAD.pvData = VarPtr(bCompValue)
tWCAD.cbData = LenB(bCompValue)
Call SetWindowCompositionAttribute(HWND, tWCAD)
End If
End Sub
Private Function IsColorSchemeChangeMessage(ByRef lParam As String) As Boolean
'bool IsColorSchemeChangeMessage(LPARAM lParam)
'{
' bool is = false;
' if (lParam && CompareStringOrdinal(reinterpret_cast<LPCWCH>(lParam), -1, L"ImmersiveColorSet", -1, TRUE) == CSTR_EQUAL)
' {
' _RefreshImmersiveColorPolicyState();
' is = true;
' }
' _GetIsImmersiveColorUsingHighContrast(IHCM_REFRESH);
' return is;
'}
Dim bIS As Boolean
bIS = False
If Len(lParam) <> 0 Then
If lParam = "ImmersiveColorSet" Then
Call RefreshImmersiveColorPolicyState
bIS = True
End If
End If
Call GetIsImmersiveColorUsingHighContrast(IHCM_REFRESH)
IsColorSchemeChangeMessage = bIS
End Function
'bool IsColorSchemeChangeMessage(UINT message, LPARAM lParam)
'{
' if (message == WM_SETTINGCHANGE)
' return IsColorSchemeChangeMessage(lParam);
' return false;
'}
Private Sub fnAllowDarkModeForApp(allow As Boolean)
'void AllowDarkModeForApp(bool allow)
'{
' if (_AllowDarkModeForApp)
' _AllowDarkModeForApp(allow);
' else if (_SetPreferredAppMode)
' _SetPreferredAppMode(allow ? AllowDark : Default);
'}
If g_buildNumber < 18362 Then
Call AllowDarkModeForApp(allow)
ElseIf allow = True Then
Call SetPreferredAppMode(AllowDark)
Else
Call SetPreferredAppMode(Default)
End If
End Sub
Private Function CheckBuildNumber(ByRef buildNumber As Long) As Boolean
'constexpr bool CheckBuildNumber(DWORD buildNumber)
'{
' return (buildNumber == 17763 || // 1809
' buildNumber == 18362 || // 1903
' buildNumber == 18363 || // 1909
' buildNumber == 19041 || // 2004
' buildNumber >= 19042); // over 2009
'}
If buildNumber = 17763 Or buildNumber = 18362 Or buildNumber = 18363 Or buildNumber = 19041 Or buildNumber >= 19042 Then
CheckBuildNumber = True
Else
CheckBuildNumber = False
End If
End Function
Public Sub InitDarkMode2(ByRef HWND As Long)
Debug.Print RefreshImmersiveColorPolicyState
Debug.Print SetPreferredAppMode(ForceDark)
Debug.Print RefreshImmersiveColorPolicyState
End Sub
Public Sub InitDarkMode(ByRef HWND As Long)
Dim major As Long
Dim minor As Long
Dim bAllow As Boolean
Call RtlGetNtVersionNumbers(major, minor, g_buildNumber)
g_buildNumber = g_buildNumber Xor &HF0000000
If major >= 10 And CheckBuildNumber(g_buildNumber) Then
'If OpenNcThemeData And
If RefreshImmersiveColorPolicyState = True Then
If ShouldAppsUseDarkMode = True Then
If AllowDarkModeForWindow(HWND, True) = True Then
If g_buildNumber < 18362 Then
Call AllowDarkModeForApp(True)
Else
Call SetPreferredAppMode(ForceDark)
End If
If IsDarkModeAllowedForWindow(HWND) = True Then
g_darkModeSupported = True
Call fnAllowDarkModeForApp(True)
Call RefreshImmersiveColorPolicyState
g_darkModeEnabled = ShouldAppsUseDarkMode() And (IsHighContrast() = False)
'FixDarkScrollBar();
End If
End If
End If
End If
End If
End Sub
-
Jun 25th, 2023, 05:12 AM
#11
Thread Starter
Hyperactive Member
Re: Windows 10 Dark Mode & VB6 apps
I found another example called Enable a Dark mode title bar for Win32 applications from Microsoft, but my translated code still not work with vb6:
C++ code:
Code:
#ifndef DWMWA_USE_IMMERSIVE_DARK_MODE
#define DWMWA_USE_IMMERSIVE_DARK_MODE 20
#endif
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
hInst = hInstance; // Store instance handle in our global variable
HWND hWnd = CreateWindowW(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, nullptr, nullptr, hInstance, nullptr);
BOOL value = TRUE;
::DwmSetWindowAttribute(hWnd, DWMWA_USE_IMMERSIVE_DARK_MODE, &value, sizeof(value));
if (!hWnd)
{
return FALSE;
}
ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);
return TRUE;
}
my VB6 code:
Code:
Private Declare Function DwmSetWindowAttribute Lib "dwmapi.dll" (ByVal HWND As Long, ByVal dwAttribute As Long, ByRef pvAttribute As Long, ByVal cbAttribute As Long) As Long
Private Const DWMWA_USE_IMMERSIVE_DARK_MODE = 20
Private Sub Form_Load()
Dim bValue As Long
bValue = 1
Call DwmSetWindowAttribute(Me.hWnd, DWMWA_USE_IMMERSIVE_DARK_MODE, bValue, LenB(bValue))
End Sub
I'm starting to think that Dark Mode isn't possible with VB6...
-
Jun 25th, 2023, 05:28 AM
#12
Re: Windows 10 Dark Mode & VB6 apps
-
Jun 25th, 2023, 05:47 AM
#13
Re: Windows 10 Dark Mode & VB6 apps
 Originally Posted by Mith
my VB6 code:
Code:
Private Declare Function DwmSetWindowAttribute Lib "dwmapi.dll" (ByVal HWND As Long, ByVal dwAttribute As Long, ByRef pvAttribute As Long, ByVal cbAttribute As Long) As Long
Private Const DWMWA_USE_IMMERSIVE_DARK_MODE = 20
Private Sub Form_Load()
Dim bValue As Long
bValue = 1
Call DwmSetWindowAttribute(Me.hWnd, DWMWA_USE_IMMERSIVE_DARK_MODE, bValue, LenB(bValue))
End Sub
I'm starting to think that Dark Mode isn't possible with VB6...
Works as it should here in my IDE on Win11 (which I have running "manifested, enabling Themes").
I'm quite sure, that all this DWM-stuff only works properly, when you include a proper manifest (either in your compiled Exe, or in the IDE itself).
Olaf
-
Jun 25th, 2023, 07:10 AM
#14
Thread Starter
Hyperactive Member
Re: Windows 10 Dark Mode & VB6 apps
 Originally Posted by fafalone
Is it working with c++?
I didnt try, but i think so, because many ppl used this code to get the dark mode title bar.
-
Jun 25th, 2023, 07:16 AM
#15
Thread Starter
Hyperactive Member
Re: Windows 10 Dark Mode & VB6 apps
 Originally Posted by Schmidt
Works as it should here in my IDE on Win11 (which I have running "manifested, enabling Themes").
I'm quite sure, that all this DWM-stuff only works properly, when you include a proper manifest (either in your compiled Exe, or in the IDE itself).
Im developing with win10 (latest) and i use this manifest file for my VB IDE:
Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
version="1.0.0.0"
processorArchitecture="X86"
name="Microsoft.VisualBasic6.IDE"
type="win32"
/>
<description>Microsoft Visual Basic 6 IDE</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="X86"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
</assembly>
and i use this manifest file for my dark mode test exe file:
Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
<assemblyIdentity
version="1.0.0.0"
processorArchitecture="*"
name="win32-darkmode"
type="win32"
/>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- Windows 10 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
<!-- Windows 8.1 -->
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
<!-- Windows Vista -->
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
<!-- Windows 7 -->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
<!-- Windows 8 -->
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
</application>
</compatibility>
<asmv3:application>
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
<dpiAware>true</dpiAware>
</asmv3:windowsSettings>
</asmv3:application>
</assembly>
Any suggestions whats wrong or missing?
-
Jun 25th, 2023, 07:24 AM
#16
Thread Starter
Hyperactive Member
Re: Windows 10 Dark Mode & VB6 apps
It works! I lost the thread from all the testing...i forgot that the color of the windows title bar only changes to dark when i switch to another window!
-
Jun 25th, 2023, 08:47 AM
#17
Thread Starter
Hyperactive Member
Re: Windows 10 Dark Mode & VB6 apps
Summary for Visual Basic 6 Dark Mode for the Form Title Bar & Control Scrollbars:

Notes:
- all controls used on the form above are from Krool's ActiveX CommonControls Replacement
- The Windows Dark Mode must not be active to use the dark mode style
- a vb manifest is not necessary to use the dark mode style
- tested with Win10.0.19045.2965
Conclusion:
It seems like that the button control is the only control that fully support the Dark Mode style.
For all other controls the developer must set the background & fore color by himself.
Unfortunately this is not possible with the OptionButton control and the CheckBox control, because the active visual style doesnt allow to change the forecolor of these controls.
The same applies to the column headers of the list view in report mode, but here you cant change the background color.
Code for the window title bar dark mode:
Code:
Private Declare Function DwmSetWindowAttribute Lib "dwmapi.dll" (ByVal HWND As Long, ByVal dwAttribute As Long, ByRef pvAttribute As Long, ByVal cbAttribute As Long) As Long
Private Const DWMWA_USE_IMMERSIVE_DARK_MODE = 20
Private Sub Form_Load()
Dim bValue As Long
bValue = 1
Call DwmSetWindowAttribute(Me.hWnd, DWMWA_USE_IMMERSIVE_DARK_MODE, bValue, LenB(bValue))
End Sub
Code for the control scrollbar dark mode:
Code:
Private Declare Function SetWindowTheme Lib "uxtheme" (ByVal hwnd As Long, ByVal pszSubAppName As Long, ByVal pszSubIdList As Long) As Long
Private Sub Form_Load()
SetWindowTheme control.hwnd, StrPtr("DarkMode_Explorer"), 0&
End Sub
Last edited by Mith; Jun 25th, 2023 at 08:37 PM.
-
Jun 25th, 2023, 09:00 AM
#18
Re: Windows 10 Dark Mode & VB6 apps
https://github.com/nptr/msstyleEditor
You can open C:\Windows\Resources\Themes\aero\aero.msstyles and notice there are a lot of "DarkMode_Xxx" classes e.g. there is "DarkMode_CFD:ComboBox" on my Win11.
Try using SetWindowTheme combobox.hWnd, StrPtr("CFD") for ComboBoxes and probably a separate call for the dropdown scollbars will be needed.
cheers,
</wqw>
-
Jun 25th, 2023, 10:30 AM
#19
Thread Starter
Hyperactive Member
Re: Windows 10 Dark Mode & VB6 apps
 Originally Posted by wqweto
Try using SetWindowTheme combobox.hWnd, StrPtr("CFD") for ComboBoxes and probably a separate call for the dropdown scollbars will be needed.
Thank you for the feedback. I tried StrPtr("CFD") with the ComboBox but no effect on the colors.
-
Jun 25th, 2023, 12:12 PM
#20
Re: Windows 10 Dark Mode & VB6 apps
You tried CFD but didn't try DarkMode_CFD and DarkMode_CFD:ComboBox? This is not how green-field research is done. . .
Did you download the tool to peak at other classes available?
cheers,
</wqw>
-
Jun 25th, 2023, 08:35 PM
#21
Thread Starter
Hyperactive Member
Re: Windows 10 Dark Mode & VB6 apps
-
Jun 25th, 2023, 09:05 PM
#22
Thread Starter
Hyperactive Member
Re: Windows 10 Dark Mode & VB6 apps
 Originally Posted by wqweto
Did you download the tool to peak at other classes available?
I downloaded the code but i cant run/compile the code. I found this on the internet:
Code:
<!-- Windows 10 Dark Mode > Toolbars, Headers, & Rebar -->
<class name="DarkModeNavbarComposited::Rebar"/>
<class name="DarkModeInactiveNavbarComposited::Rebar"/>
<class name="DarkModeMaxNavbarComposited::Rebar"/>
<class name="DarkModeMaxInactiveNavbarComposited::Rebar"/>
<class name="DarkModeNavbarBase::Rebar"/>
<class name="DarkModeNavbarNonTopmost::Rebar"/>
<class name="DarkModeNavbar::Rebar"/>
<class name="DarkModeInactiveNavbar::Rebar"/>
<class name="DarkModeMaxNavbar::Rebar"/>
<class name="DarkModeMaxInactiveNavbar::Rebar"/>
<class name="DarkMode::Toolbar"/>
<class name="DarkMode_ItemsView::Header"/>
<!-- Windows 10 Dark Mode > Address, Breadcrumb, & Search -->
<class name="DarkMode_ABComposited::AddressBand"/>
<class name="DarkMode_AddressComposited::ComboBox"/>
<class name="DarkMode_InactiveAddressComposited::ComboBox"/>
<class name="DarkMode_MaxAddressComposited::ComboBox"/>
<class name="DarkMode_MaxInactiveAddressComposited::ComboBox"/>
<class name="DarkMode_AddressComposited::Edit"/>
<class name="DarkMode_InactiveAddressComposited::Edit"/>
<class name="DarkMode_MaxAddressComposited::Edit"/>
<class name="DarkMode_MaxInactiveAddressComposited::Edit"/>
<class name="DarkMode_BBComposited::Toolbar"/>
<class name="DarkMode_InactiveBBComposited::Toolbar"/>
<class name="DarkMode_MaxBBComposited::Toolbar"/>
<class name="DarkMode_MaxInactiveBBComposited::Toolbar"/>
<class name="DarkMode::TryHarder"/>
<class name="DarkMode_SearchBoxEditComposited::Edit"/>
<class name="DarkMode_InactiveSearchBoxEditComposited::Edit"/>
<class name="DarkMode_MaxSearchBoxEditComposited::Edit"/>
<class name="DarkMode_MaxInactiveSearchBoxEditComposited::Edit"/>
<class name="DarkMode_SearchBoxComposited::SearchBox"/>
<class name="DarkMode_InactiveSearchBoxComposited::SearchBox"/>
<class name="DarkMode_MaxSearchBoxComposited::SearchBox"/>
<class name="DarkMode_MaxInactiveSearchBoxComposited::SearchBox"/>
<class name="DarkMode::SearchBox"/>
<!-- Windows 10 Dark Mode > Buttons, Boxes, & Controls -->
<class name="Explorer::Button"/>
<class name="DarkMode_Explorer::Button"/>
<class name="DarkMode::Navigation"/>
<class name="CFD::Combobox"/>
<class name="DarkMode_CFD::Combobox"/>
<class name="Explorer::ScrollBar"/>
<class name="DarkMode_Explorer::ScrollBar"/>
<!-- Windows 10 Dark Mode > Lists, Menus, & Tabs -->
<class name="DarkMode::Menu"/>
<class name="DarkMode_ImmersiveStart::Menu"/>
<!-- Windows 10 Dark Mode > Explorer & Shell -->
<class name="DarkMode_Explorer::TreeView"/>
<class name="DarkMode::CommandModule"/>
<class name="Explorer::CommandModule"/>
<class name="DarkMode_Explorer::CommandModule"/>
<class name="DarkMode_Explorer::Tooltip"/>
<class name="DarkMode::ReadingPane"/>
<class name="DarkMode::PreviewPane"/>
<class name="DarkMode::ProperTree"/>
<class name="ExplorerNavPane"/>
<class name="DarkMode::ExplorerNavPane"/>
<class name="DarkMode::ItemsView"/>
<class name="DarkMode_CFD::Edit"/>
<class name="DarkMode_Explorer::Edit"/>
<class name="DarkMode_ItemsView::ListView"/>
<class name="ExplorerStatusBar"/>
<class name="DarkMode::ExplorerStatusBar"/>
<class name="DarkMode_InfoPaneToolbar::Toolbar"/>
<class name="CommonItemsDialog"/>
<class name="DarkMode::CommonItemsDialog"/>
</add>
-
Jun 25th, 2023, 09:37 PM
#23
Thread Starter
Hyperactive Member
Re: Windows 10 Dark Mode & VB6 apps
The dark mode for the ListView column headers can be activated using the following code:
SetWindowTheme ListView1.hWndHeader, StrPtr("DarkMode_ItemsView"), 0&
-
Jun 26th, 2023, 02:35 AM
#24
Re: Windows 10 Dark Mode & VB6 apps
I'm curious about this comment of yours:
- The Windows Dark Mode must not be active to use the dark mode style
So the rest of the system will have to be in light mode in order for your application to be in dark mode?
-
Jun 26th, 2023, 05:28 AM
#25
Re: Windows 10 Dark Mode & VB6 apps
 Originally Posted by Mith
I downloaded the code but i cant run/compile the code.
There is compiled EXE under Releases link -- on repo's home page in the right column there is About section, then Releases section where it says "+27 releases".
cheers,
</wqw>
-
Jun 26th, 2023, 06:45 AM
#26
Thread Starter
Hyperactive Member
Re: Windows 10 Dark Mode & VB6 apps
 Originally Posted by fafalone
So the rest of the system will have to be in light mode in order for your application to be in dark mode?
No, it doesnt matter if the Windows Dark Mode is active or not to use the Dark Mode with a VB6 app!
-
Jun 26th, 2023, 08:21 AM
#27
Thread Starter
Hyperactive Member
Re: Windows 10 Dark Mode & VB6 apps
 Originally Posted by wqweto
There is compiled EXE under Releases link -- on repo's home page in the right column there is About section, then Releases section where it says "+27 releases".
Got the exe and the list:
-
Jun 26th, 2023, 11:45 AM
#28
Re: Windows 10 Dark Mode & VB6 apps
How did you get the scroll bars fixed? I saw some IAT hooking in the original but not the snippet you posted.
-
Jun 26th, 2023, 10:07 PM
#29
Thread Starter
Hyperactive Member
Re: Windows 10 Dark Mode & VB6 apps
 Originally Posted by fafalone
How did you get the scroll bars fixed? I saw some IAT hooking in the original but not the snippet you posted.
You will get dark scrollbars with this API call:
SetWindowTheme control.hwnd, StrPtr("DarkMode_Explorer"), 0&
-
Mar 18th, 2025, 07:42 AM
#30
Re: Windows 10 Dark Mode & VB6 apps
@Mith: Can you post code of your research project where you took the final screenshot above from, please?
Did you set form's BackColor manually and what color did you use for this? RGB(25, 25, 25)?
cheers,
</wqw>
-
Mar 18th, 2025, 07:53 PM
#31
Thread Starter
Hyperactive Member
Re: Windows 10 Dark Mode & VB6 apps
 Originally Posted by wqweto
@Mith: Can you post code of your research project where you took the final screenshot above from, please?
Unfortunately, I no longer have the program code from the time of the screenshot. The current program code uses various other external libraries for testing purposes, and it wouldn't run on your system. What information exactly do you need?
 Originally Posted by wqweto
Did you set form's BackColor manually and what color did you use for this? RGB(25, 25, 25)?
Me.BackColor = 4013373
-
Mar 20th, 2025, 09:08 AM
#32
Re: Windows 10 Dark Mode & VB6 apps
Code:
hex(4013373) = &H3D3D3D
. . . which is some sort of darker grey.
Is this TextBox background color or Form's one?
cheers,
</wqw>
-
Mar 20th, 2025, 07:25 PM
#33
Thread Starter
Hyperactive Member
Re: Windows 10 Dark Mode & VB6 apps
 Originally Posted by wqweto
Is this TextBox background color or Form's one?
I use this color for the backcolor of all forms & controls.
-
Mar 21st, 2025, 04:45 AM
#34
Re: Windows 10 Dark Mode & VB6 apps
 Originally Posted by Mith
I use this color for the backcolor of all forms & controls.
I see. Interesting -- Form's backcolor is lighter grey than TextBox and ComboBox backgrounds. .
Btw, these colors can be derived from certain theme parts i.e. using msstyleEditor one can explore where these backcolors are located for darkmode "application names" (the pszSubAppName param).
cheers,
</wqw>
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|