Drag and Drop text - What am I missing?
I am trying to add drag-and-drop text to my Doc-View App. I added the COleDropTarget variable to the view cla开发者_如何学Pythonss, registered it in OnCreate(). I added OnDragEnter(), OnDragOver(), OnDragLeave() and OnDrop() to that class as virtual overrides, but none of them are ever called. I previously had added m_pMainWnd->DragAcceptFiles(TRUE); to my App class. I tried commenting out that statement, but no affect.
I tried using Spy++ to see where the messages go while I do a drag, but it logs nothing at all while I am dragging the text around in the App.
What do I need? Or what else can I try, to narrow down the problem?
TIA,
Harvey
Solved:
In using F1 to get the syntax for OnDrop and the others, MSDN gave me:
virtual BOOL OnDrop(
CWnd* pWnd,
COleDataObject* pDataObject,
DROPEFFECT dropEffect,
CPoint point
);
But the correct virtual function does not have the first parameter and should be:
virtual BOOL OnDrop(
COleDataObject* pDataObject,
DROPEFFECT dropEffect,
CPoint point
);
Same with the others. So I was never actually overriding the default functions.
精彩评论