/ Published in: C++
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
void SetClipboardText( LPCSTR pText ) { HGLOBAL h; LPTSTR arr; int size = strlen(pText)+1; h=GlobalAlloc(GMEM_MOVEABLE, size); arr=(LPTSTR)GlobalLock(h); strcpy_s((char*)arr, size, pText); GlobalUnlock(h); ::OpenClipboard (NULL); EmptyClipboard(); SetClipboardData(CF_TEXT, h); CloseClipboard(); }
URL: stackoverflow.com/questions/2253476/does-mfc-provide-a-quick-way-to-throw-text-on-the-clipboard