summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2022-09-26 19:27:33 +0300
committerGeorge Hazan <ghazan@miranda.im>2022-09-26 19:27:33 +0300
commit35f6abcc7f069b3f239215842ec049c716f9b758 (patch)
treeca1d7ff100fd15236abdfce4639a606769fe5944 /src
parentc5dc28ec2272a865ef2f28fd7ab151b55517fedf (diff)
code cleaning
Diffstat (limited to 'src')
-rw-r--r--src/mir_core/src/Windows/winutil.cpp24
-rw-r--r--src/mir_core/src/mir_core.def3
-rw-r--r--src/mir_core/src/mir_core64.def3
3 files changed, 26 insertions, 4 deletions
diff --git a/src/mir_core/src/Windows/winutil.cpp b/src/mir_core/src/Windows/winutil.cpp
index f9c0fb18d6..7a25523482 100644
--- a/src/mir_core/src/Windows/winutil.cpp
+++ b/src/mir_core/src/Windows/winutil.cpp
@@ -136,18 +136,38 @@ MIR_CORE_DLL(int) Utils_CorrectFontSize(int size)
/////////////////////////////////////////////////////////////////////////////////////////
+MIR_CORE_DLL(void) Utils_ClipboardCopy(const char *pszText)
+{
+ size_t cbLen = mir_strlen(pszText);
+ if (!cbLen)
+ return;
+
+ if (!OpenClipboard(nullptr))
+ return;
+
+ EmptyClipboard();
+
+ HGLOBAL hData = ::GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE, cbLen);
+ if (hData) {
+ mir_strcpy((char *)GlobalLock(hData), pszText);
+ GlobalUnlock(hData);
+ SetClipboardData(CF_TEXT, hData);
+ }
+ CloseClipboard();
+}
+
MIR_CORE_DLL(void) Utils_ClipboardCopy(const wchar_t *pwszText)
{
size_t cbLen = mir_wstrlen(pwszText);
if (!cbLen)
return;
-
+
if (!OpenClipboard(nullptr))
return;
EmptyClipboard();
- HGLOBAL hData = ::GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE, (cbLen+1) * sizeof(wchar_t));
+ HGLOBAL hData = ::GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE, (cbLen + 1) * sizeof(wchar_t));
if (hData) {
mir_wstrcpy((wchar_t *)GlobalLock(hData), pwszText);
GlobalUnlock(hData);
diff --git a/src/mir_core/src/mir_core.def b/src/mir_core/src/mir_core.def
index 2a7c92d1f5..51c2de344b 100644
--- a/src/mir_core/src/mir_core.def
+++ b/src/mir_core/src/mir_core.def
@@ -1543,4 +1543,5 @@ _Utils_CorrectFontSize@4 @1762 NONAME
?OnResize@CDlgBase@@MAEXXZ @1763 NONAME
??0MBinBuffer@@QAE@ABV0@@Z @1764 NONAME
??0MBinBuffer@@QAE@I@Z @1765 NONAME
-_Utils_ClipboardCopy@4 @1766 NONAME
+?Utils_ClipboardCopy@@YGXPBD@Z @1766 NONAME
+?Utils_ClipboardCopy@@YGXPB_W@Z @1767 NONAME
diff --git a/src/mir_core/src/mir_core64.def b/src/mir_core/src/mir_core64.def
index 56c4c541d5..20ad714a5f 100644
--- a/src/mir_core/src/mir_core64.def
+++ b/src/mir_core/src/mir_core64.def
@@ -1543,4 +1543,5 @@ Utils_CorrectFontSize @1762 NONAME
?OnResize@CDlgBase@@MEAAXXZ @1763 NONAME
??0MBinBuffer@@QEAA@AEBV0@@Z @1764 NONAME
??0MBinBuffer@@QEAA@_K@Z @1765 NONAME
-Utils_ClipboardCopy @1766 NONAME
+?Utils_ClipboardCopy@@YAXPEBD@Z @1766 NONAME
+?Utils_ClipboardCopy@@YAXPEB_W@Z @1767 NONAME