Thread: Disabling OLE drag/drop for CRichEditView

  1. #1
    Magically delicious LuckY's Avatar
    Join Date
    Oct 2001
    Posts
    856

    Unhappy Disabling icon drag/drop into a CRichEditView

    I'm writing an MDI prog and have tried tirelessly to catch or remove the "on drop" message of my CRichEditView's. I've implemented drag/drop to allow the user to open files that way, but it will only work when the drop target is outside of a view (in the frame)... Of course, when the target is within a view, the icon of the source is inserted..

    I have tried to catch the WM_DROPFILES, but it appears this message is never sent during the operation in question..

    Do you know how to catch the message sent when an external icon is dragged/dropped into a CRichEditView window?
    Last edited by LuckY; 04-04-2003 at 09:11 AM.

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    You need to set the event mask for the RichEdit control to specify which notification mesages the control sends to its parent window.

    Look into CRichEditCtrl::SetEventMask and the available event mask flags. Returning 0 from the EN_DROPFILES notification should do the trick.

    gg

  3. #3
    Magically delicious LuckY's Avatar
    Join Date
    Oct 2001
    Posts
    856
    Thanks for the tip codeplug. I attempted to look up the ENM_* flags from the MSVC online documentation, with no luck.
    However, I am having difficulty applying what I've learned... The MSDN library says that a rich edit control's EN_DROPFILES message is sent in the form of a WM_NOTIFY message when it receives WM_DROPFILES.

    Here's what I'm trying:
    I added ENM_DROPFILES to my rich edit view's event mask. Then I called DragAcceptFiles(TRUE) in OnInitialUpdate() (I've tried it that way or as GetRichEditCtrl.DragAcceptFiles(TRUE).
    I've message mapped ON_WM_DROPFILES(). The handler is
    void OnDropFiles(HDROP hDropInfo);

    Any further ideas?

  4. #4
    Magically delicious LuckY's Avatar
    Join Date
    Oct 2001
    Posts
    856
    Aha!

    I figured it out. I added
    ON_NOTIFY_REFLECT(EN_DROPFILES, OnDropFiles)
    to my message map. Now I am catching the drop files message, but returning zero doesn't halt the insert of the icon! <: (

    I don't know if I'll ever figure it out. At least I'm on the right path (somewhat).

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. MSDN OLE DB Sample Provider entry point
    By George2 in forum C++ Programming
    Replies: 0
    Last Post: 07-21-2007, 07:30 AM
  2. entry point of OLE DB Provider
    By George2 in forum C# Programming
    Replies: 0
    Last Post: 07-19-2007, 04:15 AM
  3. OLE DB provider
    By George2 in forum Windows Programming
    Replies: 2
    Last Post: 05-07-2007, 01:19 AM
  4. PowerPoint and OLE Server and MFC problem
    By gicio in forum Windows Programming
    Replies: 0
    Last Post: 08-21-2003, 02:46 AM
  5. OLE Clipboard :: Win32 API vs. MFC
    By kuphryn in forum Windows Programming
    Replies: 3
    Last Post: 08-11-2002, 05:57 PM