mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2024-12-27 15:44:12 +08:00
w732
This commit is contained in:
parent
48a855f3ce
commit
f7384a43aa
@ -316,10 +316,7 @@ _SetTheme.argtypes = HWND, c_bool, c_int
|
||||
|
||||
|
||||
def SetTheme(hwnd, dark, backdrop):
|
||||
try: # win7 x86 crash unknown why
|
||||
_SetTheme(hwnd, dark, backdrop)
|
||||
except:
|
||||
pass
|
||||
_SetTheme(hwnd, dark, backdrop)
|
||||
|
||||
|
||||
showintab = utilsdll.showintab
|
||||
|
@ -1,6 +1,28 @@
|
||||
#include "define.h"
|
||||
// https://github.com/Blinue/Xaml-Islands-Cpp/blob/main/src/XamlIslandsCpp/XamlWindow.h
|
||||
|
||||
static uint32_t GetOSversion() noexcept
|
||||
{
|
||||
HMODULE hNtDll = GetModuleHandle(L"ntdll.dll");
|
||||
if (!hNtDll)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
auto rtlGetVersion = (LONG(WINAPI *)(PRTL_OSVERSIONINFOW))GetProcAddress(hNtDll, "RtlGetVersion");
|
||||
if (rtlGetVersion == nullptr)
|
||||
{
|
||||
// assert(false);
|
||||
return 0;
|
||||
}
|
||||
|
||||
RTL_OSVERSIONINFOW version{};
|
||||
version.dwOSVersionInfoSize = sizeof(version);
|
||||
rtlGetVersion(&version);
|
||||
|
||||
return version.dwMajorVersion;
|
||||
}
|
||||
|
||||
static uint32_t GetOSBuild() noexcept
|
||||
{
|
||||
HMODULE hNtDll = GetModuleHandle(L"ntdll.dll");
|
||||
@ -22,7 +44,6 @@ static uint32_t GetOSBuild() noexcept
|
||||
|
||||
return version.dwBuildNumber;
|
||||
}
|
||||
|
||||
struct Win32Helper
|
||||
{
|
||||
struct OSVersion
|
||||
@ -134,6 +155,9 @@ DECLARE void _SetTheme(
|
||||
bool dark,
|
||||
int backdrop)
|
||||
{
|
||||
// printf("%d %d\n",GetOSversion(),GetOSBuild());
|
||||
if (GetOSversion() <= 6)//win7 x32 DwmSetWindowAttribute会崩,直接禁了反正没用。不知道win8怎么样。
|
||||
return;
|
||||
// auto _isBackgroundSolidColor = backdrop == WindowBackdrop::SolidColor;
|
||||
// if (Win32Helper::GetOSVersion().Is22H2OrNewer() &&
|
||||
// _isBackgroundSolidColor != (backdrop == WindowBackdrop::SolidColor))
|
||||
|
Loading…
x
Reference in New Issue
Block a user