void CDrawView::PasteNative(COleDataObject& dataObject) { // get file refering to clipboard data CFile* pFile = dataObject.GetFileData(m_cfDraw); if (pFile == NULL) return; // connect the file to the archive CArchive ar(pFile, CArchive::load); TRY { ar.m_pDocument = GetDocument(); // set back-pointer in archive // read the selection m_selection.Serialize(ar); } CATCH_ALL(e) { ar.Close(); delete pFile; THROW_LAST(); } END_CATCH_ALL ar.Close(); delete pFile; }
void CUIDesignerView::OnEditPaste() { COleDataObject dataObject; dataObject.AttachClipboard(); if(dataObject.IsDataAvailable(m_cfUI)) { CFile* pFile = dataObject.GetFileData(m_cfUI); if (pFile == NULL) return; int len = (int)pFile->GetLength(); char* pstrXML = new char[len]; pFile->Read(pstrXML, len); PasteUI(StringConvertor::Utf8ToWide(pstrXML)); delete[] pstrXML; delete pFile; } }