This commit is contained in:
GabsPuNs
2026-04-17 18:17:36 -04:00
parent 5674bcc012
commit b9f73b00e2
19 changed files with 273 additions and 256 deletions

View File

@@ -66,7 +66,20 @@ void Screen::setClipboard(const wstring& str)
EmptyClipboard();
size_t len = (str.length() + 1) * sizeof(wchar_t);
HGLOBAL h = GlobalAlloc(GMEM_MOVEABLE, len);
if (h) { memcpy(GlobalLock(h), str.c_str(), len); GlobalUnlock(h); SetClipboardData(CF_UNICODETEXT, h); }
if (h)
{
void* ptr = GlobalLock(h);
if (ptr)
{
memcpy_s(ptr, len, str.c_str(), len);
GlobalUnlock(h);
SetClipboardData(CF_UNICODETEXT, h);
}
else
{
GlobalFree(h);
}
}
CloseClipboard();
#endif
}