I have a png image as string ..
Then copy to clipboard with ...std::string str(png_encoding.begin(), png_encoding.end());
Code: Select all
void toClipboard(const std::string& s) {
CloseClipboard();
OpenClipboard(0);
EmptyClipboard();
HGLOBAL hg = GlobalAlloc(GMEM_MOVEABLE, s.size());
if (!hg) {
CloseClipboard();
return;
}
memcpy(GlobalLock(hg), s.c_str(), s.size());
GlobalUnlock(hg);
SetClipboardData(CF_TEXT, hg);
CloseClipboard();
GlobalFree(hg);
}
Code: Select all
wxString clip;
// Read some text
if (wxTheClipboard->Open())
{
if (wxTheClipboard->IsSupported( wxDF_TEXT ))
{
wxTextDataObject data;
wxTheClipboard->GetData( data );
clip=( data.GetText() );
}
wxTheClipboard->Close();
}
vector<unsigned char> image(clip.begin(), clip.end());
Is any good function?
Thank's
Jim