From d81aa161e4fbbf855cac695ae43f983f9d92e463 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=81=8D=E5=85=AE=E6=83=9A=E5=85=AE?= <1173718158@qq.com> Date: Fri, 15 Nov 2024 03:25:43 +0800 Subject: [PATCH] fix --- cpp/winsharedutils/applicationloopbackaudio/runer.cpp | 3 ++- cpp/winsharedutils/theme.cpp | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/cpp/winsharedutils/applicationloopbackaudio/runer.cpp b/cpp/winsharedutils/applicationloopbackaudio/runer.cpp index 77fa3e36..abf67fac 100644 --- a/cpp/winsharedutils/applicationloopbackaudio/runer.cpp +++ b/cpp/winsharedutils/applicationloopbackaudio/runer.cpp @@ -1,6 +1,7 @@ +#ifndef WINXP #include "LoopbackCapture.h" - +#endif DECLARE_API HANDLE StartCaptureAsync(void (*datacb)(void *ptr, size_t size)) { #ifndef WINXP diff --git a/cpp/winsharedutils/theme.cpp b/cpp/winsharedutils/theme.cpp index 670f3fd9..2346d0ab 100644 --- a/cpp/winsharedutils/theme.cpp +++ b/cpp/winsharedutils/theme.cpp @@ -130,6 +130,7 @@ static bool InitApis() noexcept static void SetWindowTheme(HWND hWnd, bool darkBorder, bool darkMenu) noexcept { +#ifndef WINXP if (!InitApis()) return; @@ -149,11 +150,14 @@ static void SetWindowTheme(HWND hWnd, bool darkBorder, bool darkMenu) noexcept RefreshImmersiveColorPolicyState(); FlushMenuThemes(); +#endif } DECLARE_API void setdwmextendframe(HWND hwnd) { +#ifndef WINXP MARGINS mar{-1, -1, -1, -1}; DwmExtendFrameIntoClientArea(hwnd, &mar); +#endif } DECLARE_API void _SetTheme( @@ -161,6 +165,7 @@ DECLARE_API void _SetTheme( bool dark, int backdrop) { +#ifndef WINXP // printf("%d %d\n",GetOSversion(),GetOSBuild()); if (GetOSversion() <= 6) // win7 x32 DwmSetWindowAttribute会崩,直接禁了反正没用。不知道win8怎么样。 return; @@ -189,10 +194,12 @@ DECLARE_API void _SetTheme( DWM_SYSTEMBACKDROP_TYPE value = BACKDROP_MAP[backdrop]; // 不管操作系统版本了,硬设置就行,测试不会崩溃,让系统自己处理。 DwmSetWindowAttribute(_hWnd, DWMWA_SYSTEMBACKDROP_TYPE, &value, sizeof(value)); +#endif } DECLARE_API bool isDark() { +#ifndef WINXP HKEY hKey; const char *subKey = "Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize"; if (RegOpenKeyExA(HKEY_CURRENT_USER, subKey, 0, KEY_READ, &hKey) == ERROR_SUCCESS) @@ -206,5 +213,6 @@ DECLARE_API bool isDark() } RegCloseKey(hKey); } +#endif return false; } \ No newline at end of file