Merge pull request #1608 from jdpatdiscord/develop

Allow compilation on 32-bit
This commit is contained in:
Lenny McLennington 2023-10-19 10:44:36 +01:00 committed by GitHub
commit 7dff3e5afc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -73,8 +73,10 @@ void setWindowDarkModeEnabled(HWND hWnd, bool Enabled)
sizeof(DarkEnabled)
};
#ifdef _WIN64
constexpr int NtUserSetWindowCompositionAttribute_NT6_2 = 0x13b4;
constexpr int NtUserSetWindowCompositionAttribute_NT6_3 = 0x13e5;
if (IsWindows8_0_Only())
WinSyscall<NtUserSetWindowCompositionAttribute_NT6_2>(hWnd, &data);
else if (IsWindows8_1_Only())
@ -87,6 +89,16 @@ void setWindowDarkModeEnabled(HWND hWnd, bool Enabled)
((fnSetPreferredAppMode)(PVOID)GetProcAddress(GetModuleHandleW(L"uxtheme.dll"), MAKEINTRESOURCEA(135)))
(AppMode_AllowDark);
}
#else
if (IsWindows10_Only())
{
((fnSetWindowCompositionAttribute)(PVOID)GetProcAddress(GetModuleHandleW(L"user32.dll"), "SetWindowCompositionAttribute"))
(hWnd, &data);
// Verified this ordinal is the same through Win11 22H2 (5/8/2023)
((fnSetPreferredAppMode)(PVOID)GetProcAddress(GetModuleHandleW(L"uxtheme.dll"), MAKEINTRESOURCEA(135)))
(AppMode_AllowDark);
}
#endif
}