Textractor/extensions/copyclipboard.cpp

17 lines
540 B
C++
Raw Permalink Normal View History

#include "extension.h"
2018-09-22 15:08:31 -04:00
bool ProcessSentence(std::wstring& sentence, SentenceInfo sentenceInfo)
{
if (sentenceInfo["current select"] && sentenceInfo["process id"] != 0)
{
2018-11-15 00:06:10 -05:00
if (!OpenClipboard(FindWindowW(NULL, L"Textractor"))) return false;
HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE, (sentence.size() + 2) * sizeof(wchar_t));
memcpy(GlobalLock(hMem), sentence.c_str(), (sentence.size() + 2) * sizeof(wchar_t));
EmptyClipboard();
SetClipboardData(CF_UNICODETEXT, hMem);
2018-11-15 00:06:10 -05:00
GlobalUnlock(hMem);
CloseClipboard();
}
return false;
2018-12-18 16:55:07 -05:00
}