MSHTML GetDropTarget and RegisterDragDrop
Posted on 2006-07-13
I am deriving a window from CAxWindow and setting up an MSHTML control.
CWindowImpl<CMyWindow,CAxWindow,CWinTraits<WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS> >
I also set up a DocHostUIHander with SetExternalUIHandler. That seems to work... as evidenced by the ShowContextMenu method getting called.
However, GetDropTarget is not getting called.
How do I set it up so that GetDropTarget is in fact called by MSHTML or, alternatively, that my own IDropTarget interface methods are called?
I have tried RegisterDropTarget, but can't seem to find the HWND to make it work. I've used m_spWebBrowser->get_HWND from the MSHTML control, but that always returns NULL. When I try to get the HWND from the host container using CMyWindow.operator HWND, I get NULL.
And if I register the drop to just the frame that is the parent of my container, then the Drop interfaces are called when I am over the frame, but not when over the MSHTML window. And GetDropTarget is never called.
My next attempt will be to scan the window hierarchy manually to find the HWND. But that's gotta be the hard way to do it.
Any help is appreciated.