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 }