Transfer of text data on the clipboard

xiaoxiao2021-03-06  113

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 ()

转载请注明原文地址:https://www.9cbs.com/read-99114.html

New Post(0)