From 30a9e9e370aa9aff9f64158aa0942b471621a7ef Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 26 Sep 2022 18:23:52 +0300 Subject: Utils_ClipboardCopy - system-wide helper for writing text to clipboard --- plugins/NewStory/src/history_control.cpp | 2 +- plugins/NewStory/src/utils.cpp | 12 ------------ plugins/NewStory/src/utils.h | 2 -- 3 files changed, 1 insertion(+), 15 deletions(-) (limited to 'plugins/NewStory') diff --git a/plugins/NewStory/src/history_control.cpp b/plugins/NewStory/src/history_control.cpp index bf292ba1b7..2ce131b9a3 100644 --- a/plugins/NewStory/src/history_control.cpp +++ b/plugins/NewStory/src/history_control.cpp @@ -648,7 +648,7 @@ LRESULT CALLBACK NewstoryListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM res.Append(ptrW(TplFormatString(p->getCopyTemplate(), p->hContact, p))); } - CopyText(hwnd, res); + Utils_ClipboardCopy(res); } __fallthrough; // End of history list control messages diff --git a/plugins/NewStory/src/utils.cpp b/plugins/NewStory/src/utils.cpp index 4102ab3887..d1bf1e82a7 100644 --- a/plugins/NewStory/src/utils.cpp +++ b/plugins/NewStory/src/utils.cpp @@ -17,15 +17,3 @@ bool CheckFilter(wchar_t *buf, wchar_t *filter) return true; return false; } - -void CopyText(HWND hwnd, const wchar_t *text) -{ - OpenClipboard(hwnd); - EmptyClipboard(); - HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE, sizeof(wchar_t) * (mir_wstrlen(text) + 1)); - wchar_t *s = (wchar_t *)GlobalLock(hMem); - mir_wstrcpy(s, text); - GlobalUnlock(hMem); - SetClipboardData(CF_UNICODETEXT, hMem); - CloseClipboard(); -} diff --git a/plugins/NewStory/src/utils.h b/plugins/NewStory/src/utils.h index 903134dc4b..0b69a5d0e6 100644 --- a/plugins/NewStory/src/utils.h +++ b/plugins/NewStory/src/utils.h @@ -1,4 +1,2 @@ uint32_t toggleBit(uint32_t dw, uint32_t bit); bool CheckFilter(wchar_t *buf, wchar_t *filter); - -void CopyText(HWND hwnd, const wchar_t *text); -- cgit v1.2.3