diff options
author | George Hazan <ghazan@miranda.im> | 2022-09-26 18:23:52 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2022-09-26 18:23:52 +0300 |
commit | 30a9e9e370aa9aff9f64158aa0942b471621a7ef (patch) | |
tree | 013f47dfcc748e7a816eb3b59a9ee852d34de0ad /plugins/NewStory | |
parent | cb0412427ffb4819f2026906f259f4a2dd3ef177 (diff) |
Utils_ClipboardCopy - system-wide helper for writing text to clipboard
Diffstat (limited to 'plugins/NewStory')
-rw-r--r-- | plugins/NewStory/src/history_control.cpp | 2 | ||||
-rw-r--r-- | plugins/NewStory/src/utils.cpp | 12 | ||||
-rw-r--r-- | plugins/NewStory/src/utils.h | 2 |
3 files changed, 1 insertions, 15 deletions
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); |