Textractor_test/extensions/copyclipboard.cpp

16 lines
498 B
C++
Raw Normal View History

#include "extensions.h"
2018-09-23 03:08:31 +08:00
bool ProcessSentence(std::wstring& sentence, SentenceInfo sentenceInfo)
{
2018-09-23 03:08:31 +08:00
if (sentenceInfo["current select"] == 1 && sentenceInfo["hook address"] != -1)
{
HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE, (sentence.size() + 2) * sizeof(wchar_t));
memcpy(GlobalLock(hMem), sentence.c_str(), (sentence.size() + 2) * sizeof(wchar_t));
GlobalUnlock(hMem);
OpenClipboard(0);
EmptyClipboard();
SetClipboardData(CF_UNICODETEXT, hMem);
CloseClipboard();
}
return false;
}