The text is placed into the splicing plate: CString source; // put your text in sourceif (OpenClipboard ()) {HGLOBAL clipbuffer; char * buffer; EmptyClipboard (); clipbuffer = GlobalAlloc (GMEM_DDESHARE, source.GetLength () 1); Buffer = (CHAR *) Globalock (CLIPBUFFER); STRCPY (Buffer, LPCSTR (Source)); GlobalUnlock (Clipbuff (CF_Text, Clipbuffer; CloseClipboard ();
Get text from the splic plate: char * buffer; if (OpenClipboard ()) {buffer = (char *) getclipboardData (cf_text); // do sometying with buffer here // before it goes out of scope} closeclipboard ()