diff --git a/src/she/win/clipboard.cpp b/src/she/win/clipboard.cpp index 9d0449aca..0e105cb61 100644 --- a/src/she/win/clipboard.cpp +++ b/src/she/win/clipboard.cpp @@ -42,9 +42,9 @@ std::string ClipboardWin32::getText(DisplayHandle hwnd) if (IsClipboardFormatAvailable(CF_UNICODETEXT)) { if (open_clipboard((HWND)hwnd)) { HGLOBAL hglobal = GetClipboardData(CF_UNICODETEXT); - if (hglobal != NULL) { + if (hglobal) { LPWSTR lpstr = static_cast(GlobalLock(hglobal)); - if (lpstr != NULL) { + if (lpstr) { text = base::to_utf8(lpstr).c_str(); GlobalUnlock(hglobal); } @@ -52,6 +52,19 @@ std::string ClipboardWin32::getText(DisplayHandle hwnd) CloseClipboard(); } } + else if (IsClipboardFormatAvailable(CF_TEXT)) { + if (open_clipboard((HWND)hwnd)) { + HGLOBAL hglobal = GetClipboardData(CF_TEXT); + if (hglobal) { + LPSTR lpstr = static_cast(GlobalLock(hglobal)); + if (lpstr) { + text = lpstr; + GlobalUnlock(hglobal); + } + } + CloseClipboard(); + } + } return text; }