if(OpenClipboard())
{//复制到剪贴板
len = m_quickdata[nHotKeyId-10].lpQuickText.GetLength()+1;
clipbuffer = GlobalAlloc(GHND,len);
buffer = (char *)GlobalLock(clipbuffer);
_tcscpy_s(buffer,len,m_quickdata[nHotKeyId-10].lpQuickText);
GlobalUnlock(clipbuffer);
EmptyClipboard();
SetClipboardData(RegisterClipboardFormat(CF_RTF),clipbuffer);
CloseClipboard();
}
使用这种方法按Ctrl+V的时候可以粘贴到WPS文字中,但是不能粘贴到记事本、QQ中。有什么办法可以将RTF字符串复制到剪贴板中,并且可以粘贴到记事本、QQ这样的程序中呢?
{//复制到剪贴板
len = m_quickdata[nHotKeyId-10].lpQuickText.GetLength()+1;
clipbuffer = GlobalAlloc(GHND,len);
buffer = (char *)GlobalLock(clipbuffer);
_tcscpy_s(buffer,len,m_quickdata[nHotKeyId-10].lpQuickText);
GlobalUnlock(clipbuffer);
EmptyClipboard();
SetClipboardData(RegisterClipboardFormat(CF_RTF),clipbuffer);
CloseClipboard();
}
使用这种方法按Ctrl+V的时候可以粘贴到WPS文字中,但是不能粘贴到记事本、QQ中。有什么办法可以将RTF字符串复制到剪贴板中,并且可以粘贴到记事本、QQ这样的程序中呢?
void CMyView::OnEditCopy()
{
// Create an OLE data source on the heap
COleDataSource* pData = new COleDataSource;
// ...
// Get the currently selected data
// ...
// For the appropriate data formats...
pData->CacheData( CF_??, hData );
// ...
// The Clipboard now owns the allocated memory
// and will delete this data object
// when new data is put on the Clipboard
pData->SetClipboard();
}