复制到板上:
CString source;
if(OpenClipboard())
{
HGLOBLA clipbuffer;
char *buffer;
EmptyClipboard();
clipbuffer=GlobalAlloc(GMEM_DDESHARE,source.GetLength()+1);
buffer=(char *)GlobalLock(clipbuffer);
strcpy(buffer,LPCSTR(source));
GlobalUnLock(clipbuffer);
SetClipboardData(CF_TEXT,clipbuffer);
CloseClipboard();
}
====================
从板读取:
char *buffer;
if(OpenClipboard())
buffer=(char*)GetClipboardData(CF_TEXT);
CloseClipboard();
阅读(3544) | 评论(0) | 转发(0) |