Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

CRichEditView::QueryAcceptData

Called by the framework to paste an object into the rich edit.

virtual HRESULT QueryAcceptData( 
   LPDATAOBJECT lpdataobj, 
   CLIPFORMAT* lpcfFormat, 
   DWORD dwReco, 
   BOOL bReally, 
   HGLOBAL hMetaFile  
);

lpdataobj

Pointer to the IDataObject to query.

lpcfFormat

Pointer to the acceptable data format.

dwReco

Not used.

bReally

Indicates if the paste operation should continue or not.

hMetaFile

A handle to the metafile used for drawing the item's icon.

An HRESULT value reporting the success of the operation.

Override this function to handle different organization of COM items in your derived document class. This is an advanced overridable.

For more information on HRESULT and IDataObject, see Structure of COM Error Codes and IDataObject, respectively, in the Windows SDK.

// This code fragment is taken from the Wordpad sample.
HRESULT CMyRichEditView::QueryAcceptData(LPDATAOBJECT lpdataobj, 
   CLIPFORMAT* lpcfFormat, DWORD dwReco, BOOL bReally, HGLOBAL hMetaFile)
{
   if (bReally && *lpcfFormat == 0 && (m_nPasteType == 0))
   {
      COleDataObject dataobj;
      dataobj.Attach(lpdataobj, FALSE);
      if (!dataobj.IsDataAvailable(cfRTO)) // native avail, let  
                                           // richedit do as it wants
      {
         if (dataobj.IsDataAvailable(cfEmbeddedObject))
         {
            if (PasteNative(lpdataobj)) // See WordPad sample for info 
                                        // on PasteNative 
               return S_FALSE;
         }
      }
   }
   return CRichEditView::QueryAcceptData(lpdataobj, lpcfFormat, dwReco, 
      bReally, hMetaFile);
}

Header: afxrich.h

Community Additions

ADD
Show:
© 2015 Microsoft