From 53b87c3cbe3511408694832d0ade1f61cb0c5086 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 07:57:15 +0800 Subject: [PATCH] dwm --- cpp/pch.h | 1 - cpp/winrtutils/CMakeLists.txt | 2 +- cpp/winsharedutils/AreoAcrylic.cpp | 12 ++++++++++++ cpp/winsharedutils/CMakeLists.txt | 2 +- 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/cpp/pch.h b/cpp/pch.h index c3adccdb..29aaa737 100644 --- a/cpp/pch.h +++ b/cpp/pch.h @@ -74,7 +74,6 @@ #pragma comment(lib, "shlwapi.lib") #pragma comment(lib, "winmm.lib") -#pragma comment(lib, "dwmapi.lib") #pragma comment(lib, "Psapi.lib") #pragma comment(lib, "Version.lib") diff --git a/cpp/winrtutils/CMakeLists.txt b/cpp/winrtutils/CMakeLists.txt index 123ff2cf..be0df3c4 100644 --- a/cpp/winrtutils/CMakeLists.txt +++ b/cpp/winrtutils/CMakeLists.txt @@ -12,7 +12,7 @@ generate_product_version( add_library(winrtutils MODULE winrtsnapshot.cpp winrtocr.cpp livecaptions.cpp ${versioninfo}) target_precompile_headers(winrtutils REUSE_FROM pch) -target_link_libraries(winrtutils wil) +target_link_libraries(winrtutils wil dwmapi) if(${CMAKE_SIZEOF_VOID_P} EQUAL 8) set_target_properties(winrtutils PROPERTIES OUTPUT_NAME "winrtutils64") else() diff --git a/cpp/winsharedutils/AreoAcrylic.cpp b/cpp/winsharedutils/AreoAcrylic.cpp index 7fbaf95d..0dd0511a 100644 --- a/cpp/winsharedutils/AreoAcrylic.cpp +++ b/cpp/winsharedutils/AreoAcrylic.cpp @@ -86,6 +86,7 @@ typedef BOOL(WINAPI *pfnSetWindowCompositionAttribute)(HWND, WINDOWCOMPOSITIONAT DECLARE_API bool setAcrylicEffect(HWND hwnd, bool isEnableShadow) { +#ifndef WINXP // win7全都用areo DWM_BLURBEHIND bb = {0}; bb.dwFlags = DWM_BB_ENABLE; @@ -101,9 +102,13 @@ DECLARE_API bool setAcrylicEffect(HWND hwnd, bool isEnableShadow) auto accentFlags = isEnableShadow ? (DWORD(0x20 | 0x40 | 0x80 | 0x100)) : 0; accentPolicy.AccentFlags = accentFlags; return setWindowCompositionAttribute(hwnd, &winCompAttrData); +#else + return false; +#endif } DECLARE_API bool setAeroEffect(HWND hwnd, bool isEnableShadow) { +#ifndef WINXP DWM_BLURBEHIND bb = {0}; bb.dwFlags = DWM_BB_ENABLE; bb.fEnable = true; @@ -116,9 +121,13 @@ DECLARE_API bool setAeroEffect(HWND hwnd, bool isEnableShadow) auto accentFlags = isEnableShadow ? (DWORD(0x20 | 0x40 | 0x80 | 0x100)) : 0; accentPolicy.AccentFlags = accentFlags; return setWindowCompositionAttribute(hwnd, &winCompAttrData); +#else + return false; +#endif } DECLARE_API bool clearEffect(HWND hwnd) { +#ifndef WINXP DWM_BLURBEHIND bb = {0}; bb.dwFlags = DWM_BB_ENABLE; bb.fEnable = false; @@ -128,4 +137,7 @@ DECLARE_API bool clearEffect(HWND hwnd) common accentPolicy.AccentState = ACCENT_DISABLED; return setWindowCompositionAttribute(hwnd, &winCompAttrData); +#else + return false; +#endif } \ No newline at end of file diff --git a/cpp/winsharedutils/CMakeLists.txt b/cpp/winsharedutils/CMakeLists.txt index 7ce5ed5c..720dde09 100644 --- a/cpp/winsharedutils/CMakeLists.txt +++ b/cpp/winsharedutils/CMakeLists.txt @@ -15,7 +15,7 @@ applicationloopbackaudio/runer.cpp applicationloopbackaudio/LoopbackCapture.cpp SimpleBrowser.cpp MWebBrowser.cpp icon.cpp ${versioninfo}) target_precompile_headers(winsharedutils REUSE_FROM pch) if(NOT WINXP) -target_link_libraries(winsharedutils tinymp3 rapidfuzz wil webview2 Mfplat mfuuid Mmdevapi) +target_link_libraries(winsharedutils tinymp3 rapidfuzz wil webview2 Mfplat mfuuid Mmdevapi dwmapi) target_link_options(winsharedutils PRIVATE "/DELAYLOAD:Mmdevapi.dll") target_link_options(winsharedutils PRIVATE "/DELAYLOAD:Mfplat.dll") else()