读取: CString strClipboard; if (OpenClipboard(NULL)) ... { HANDLE hData = GetClipboardData(CF_TEXT); char * buffer = (char*)GlobalLock(hData); strClipboard = buffer; GlobalUnlock(hData); CloseClipboard();} AfxMessageBox(strClipboard); 写入: CString strClip = " aaa/nbbb/nccc/n " ; if (OpenClipboard(NULL)) ... { HGLOBAL clipbuf; char* buf; EmptyClipboard(); clipbuf = GlobalAlloc(GMEM_DDESHARE, strClip.GetLength()+1); buf = (char*)GlobalLock(clipbuf); strcpy(buf, strClip); GlobalUnlock(clipbuf); SetClipboardData(CF_TEXT, clipbuf); CloseClipboard();}