This commit is contained in:
恍兮惚兮 2024-11-15 07:57:15 +08:00
parent 6f51724dba
commit 53b87c3cbe
4 changed files with 14 additions and 3 deletions

View File

@ -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")

View File

@ -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()

View File

@ -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
}

View File

@ -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()