From 6c9e4e1243b5c69207fd2712fc77c28808071c46 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: Thu, 26 Dec 2024 01:10:17 +0800 Subject: [PATCH] . --- cpp/winsharedutils/CMakeLists.txt | 2 +- cpp/winsharedutils/hwnd.cpp | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/cpp/winsharedutils/CMakeLists.txt b/cpp/winsharedutils/CMakeLists.txt index 5e8a65a5..720dde09 100644 --- a/cpp/winsharedutils/CMakeLists.txt +++ b/cpp/winsharedutils/CMakeLists.txt @@ -19,7 +19,7 @@ target_link_libraries(winsharedutils tinymp3 rapidfuzz wil webview2 Mfplat mfuui target_link_options(winsharedutils PRIVATE "/DELAYLOAD:Mmdevapi.dll") target_link_options(winsharedutils PRIVATE "/DELAYLOAD:Mfplat.dll") else() -target_link_libraries(winsharedutils tinymp3 wil) +target_link_libraries(winsharedutils tinymp3) endif() if(${CMAKE_SIZEOF_VOID_P} EQUAL 8) set_target_properties(winsharedutils PROPERTIES OUTPUT_NAME "winsharedutils64") diff --git a/cpp/winsharedutils/hwnd.cpp b/cpp/winsharedutils/hwnd.cpp index be530f8f..71362446 100644 --- a/cpp/winsharedutils/hwnd.cpp +++ b/cpp/winsharedutils/hwnd.cpp @@ -1,6 +1,7 @@ - +#ifndef WINXP #include #include +#endif DECLARE_API void showintab(HWND hwnd, bool show, bool tool) { // WS_EX_TOOLWINDOW可以立即生效,WS_EX_APPWINDOW必须切换焦点才生效。但是WS_EX_TOOLWINDOW会改变窗口样式,因此只对无边框窗口使用。 @@ -160,6 +161,7 @@ DECLARE_API bool check_window_viewable(HWND hwnd) DECLARE_API void GetSelectedText(void (*cb)(const wchar_t *)) { +#ifndef WINXP CoInitialize(nullptr); try { @@ -213,4 +215,5 @@ DECLARE_API void GetSelectedText(void (*cb)(const wchar_t *)) printf(e.what()); } CoUninitialize(); +#endif }