From 34607abe680ffe2bca437f502b03778fb262c8cd Mon Sep 17 00:00:00 2001 From: fanlumaster <1730976608@qq.com> Date: Sat, 22 Mar 2025 16:47:43 +0800 Subject: [PATCH] adjust debug condition --- .vscode/custom.code-snippets | 2 +- src/Candidate/CandidateListUIPresenter.cpp | 15 ++++++++++++--- src/Window/CandidateWindow.cpp | 14 +++++++++++--- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/.vscode/custom.code-snippets b/.vscode/custom.code-snippets index ba3b4a6f..f62f848a 100644 --- a/.vscode/custom.code-snippets +++ b/.vscode/custom.code-snippets @@ -1,7 +1,7 @@ { "Debug snippets": { "scope": "c,cpp", - "prefix": "fdebug", + "prefix": "dbug", "body": [ "#ifdef FANY_DEBUG", "#endif", diff --git a/src/Candidate/CandidateListUIPresenter.cpp b/src/Candidate/CandidateListUIPresenter.cpp index a0a078cd..23780e1f 100644 --- a/src/Candidate/CandidateListUIPresenter.cpp +++ b/src/Candidate/CandidateListUIPresenter.cpp @@ -1075,11 +1075,20 @@ VOID CCandidateListUIPresenter::_LayoutChangeNotification(_In_ RECT *lpRect) cds.dwData = 0; cds.cbData = sizeof(POINT); cds.lpData = &Global::PointDTO; - if (!SendMessage(UIHwnd, WM_COPYDATA, (WPARAM)UIHwnd, (LPARAM)&cds)) + + LRESULT result = SendMessage(UIHwnd, WM_COPYDATA, (WPARAM)UIHwnd, (LPARAM)&cds); + if (result == 0) { DWORD error = GetLastError(); - std::wstring errorString = L"PostMessage failed with error: " + std::to_wstring(error); - Global::LogMessageW(errorString.c_str()); + if (error != 0) + { + std::wstring errorString = L"SendMessage POINT failed with error: " + std::to_wstring(error); + Global::LogMessageW(errorString.c_str()); + } + else + { + Global::LogMessageW(L"SendMessage POINT success, but result is 0"); + } } } diff --git a/src/Window/CandidateWindow.cpp b/src/Window/CandidateWindow.cpp index 19506af1..f3668f07 100644 --- a/src/Window/CandidateWindow.cpp +++ b/src/Window/CandidateWindow.cpp @@ -575,11 +575,19 @@ void CCandidateWindow::_DrawListWithWebview2(_In_ UINT iIndex) cds.dwData = 1; cds.cbData = (candWString.size() + 1) * sizeof(WCHAR); cds.lpData = (PVOID)candWString.c_str(); - if (!SendMessage(UIHwnd, WM_COPYDATA, (WPARAM)UIHwnd, (LPARAM)&cds)) + LRESULT result = SendMessage(UIHwnd, WM_COPYDATA, (WPARAM)UIHwnd, (LPARAM)&cds); + if (result == 0) { DWORD error = GetLastError(); - std::wstring errorString = L"PostMessage failed with error: " + std::to_wstring(error); - Global::LogMessageW(errorString.c_str()); + if (error != 0) + { + std::wstring errorString = L"SendMessage CandidateWString failed with error: " + std::to_wstring(error); + Global::LogMessageW(errorString.c_str()); + } + else + { + Global::LogMessageW(L"SendMessage CandidateWString success, but result is 0"); + } } } }