Skip to content

Commit

Permalink
Allow compilation on 32-bit
Browse files Browse the repository at this point in the history
  • Loading branch information
jdpatdiscord committed Oct 19, 2023
1 parent 9bc2873 commit 93d8682
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions launcher/ui/WinDarkmode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand All @@ -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

}

Expand Down

0 comments on commit 93d8682

Please sign in to comment.