This commit is contained in:
恍兮惚兮 2024-11-15 03:25:43 +08:00
parent 3692b24a75
commit d81aa161e4
2 changed files with 10 additions and 1 deletions

View File

@ -1,6 +1,7 @@
#ifndef WINXP
#include "LoopbackCapture.h" #include "LoopbackCapture.h"
#endif
DECLARE_API HANDLE StartCaptureAsync(void (*datacb)(void *ptr, size_t size)) DECLARE_API HANDLE StartCaptureAsync(void (*datacb)(void *ptr, size_t size))
{ {
#ifndef WINXP #ifndef WINXP

View File

@ -130,6 +130,7 @@ static bool InitApis() noexcept
static void SetWindowTheme(HWND hWnd, bool darkBorder, bool darkMenu) noexcept static void SetWindowTheme(HWND hWnd, bool darkBorder, bool darkMenu) noexcept
{ {
#ifndef WINXP
if (!InitApis()) if (!InitApis())
return; return;
@ -149,11 +150,14 @@ static void SetWindowTheme(HWND hWnd, bool darkBorder, bool darkMenu) noexcept
RefreshImmersiveColorPolicyState(); RefreshImmersiveColorPolicyState();
FlushMenuThemes(); FlushMenuThemes();
#endif
} }
DECLARE_API void setdwmextendframe(HWND hwnd) DECLARE_API void setdwmextendframe(HWND hwnd)
{ {
#ifndef WINXP
MARGINS mar{-1, -1, -1, -1}; MARGINS mar{-1, -1, -1, -1};
DwmExtendFrameIntoClientArea(hwnd, &mar); DwmExtendFrameIntoClientArea(hwnd, &mar);
#endif
} }
DECLARE_API void _SetTheme( DECLARE_API void _SetTheme(
@ -161,6 +165,7 @@ DECLARE_API void _SetTheme(
bool dark, bool dark,
int backdrop) int backdrop)
{ {
#ifndef WINXP
// printf("%d %d\n",GetOSversion(),GetOSBuild()); // printf("%d %d\n",GetOSversion(),GetOSBuild());
if (GetOSversion() <= 6) // win7 x32 DwmSetWindowAttribute会崩直接禁了反正没用。不知道win8怎么样。 if (GetOSversion() <= 6) // win7 x32 DwmSetWindowAttribute会崩直接禁了反正没用。不知道win8怎么样。
return; return;
@ -189,10 +194,12 @@ DECLARE_API void _SetTheme(
DWM_SYSTEMBACKDROP_TYPE value = BACKDROP_MAP[backdrop]; DWM_SYSTEMBACKDROP_TYPE value = BACKDROP_MAP[backdrop];
// 不管操作系统版本了,硬设置就行,测试不会崩溃,让系统自己处理。 // 不管操作系统版本了,硬设置就行,测试不会崩溃,让系统自己处理。
DwmSetWindowAttribute(_hWnd, DWMWA_SYSTEMBACKDROP_TYPE, &value, sizeof(value)); DwmSetWindowAttribute(_hWnd, DWMWA_SYSTEMBACKDROP_TYPE, &value, sizeof(value));
#endif
} }
DECLARE_API bool isDark() DECLARE_API bool isDark()
{ {
#ifndef WINXP
HKEY hKey; HKEY hKey;
const char *subKey = "Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize"; const char *subKey = "Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize";
if (RegOpenKeyExA(HKEY_CURRENT_USER, subKey, 0, KEY_READ, &hKey) == ERROR_SUCCESS) if (RegOpenKeyExA(HKEY_CURRENT_USER, subKey, 0, KEY_READ, &hKey) == ERROR_SUCCESS)
@ -206,5 +213,6 @@ DECLARE_API bool isDark()
} }
RegCloseKey(hKey); RegCloseKey(hKey);
} }
#endif
return false; return false;
} }