Link to home
Start Free TrialLog in
Avatar of midthune
midthune

asked on

RichText Overkill

I'm using a CRichEditView based MDI for large file support and custom colors/fonts, but I don't want users to be able to drag and drop anything but plain text into the client area, is there a simple way of disabling this without learning OLE?
ASKER CERTIFIED SOLUTION
Avatar of Tommy Hui
Tommy Hui

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Tommy Hui
Tommy Hui

Your code would look like

HRESULT CMyView::QueryAcceptData(LPDATAOBJECT lpdataobj, CLIPFORMAT* lpcfFormat,
      DWORD dwReco, BOOL bReally, HGLOBAL hMetaPict)
{
      if (lpcfFormat == NULL)
            return S_FALSE;

      if (!bReally)
            return S_OK;

      COleDataObject obj;
      obj.Attach(lpdataobj);
      if (obj.IsDataAvailable(CF_TEXT))
      {
            *lpcfFormat = CF_TEXT;
            obj.Detach();
            return S_OK;
      }
      else
      {
            obj.Detach();
      }

      TRACE("format = %d\r\n", *lpcfFormat);

      if (*lpcfFormat == CF_TEXT)
            return CRichEditView::QueryAcceptData(lpdataobj, lpcfFormat, dwReco,
                  bReally, hMetaPict);
      else
            return S_FALSE;
}

Avatar of midthune

ASKER

Aha! Well, I was on the right track... I just didn't know what function to override (this OLE stuff is confusing for mere mortals like myself). Thank you!