RE: WebBrowser and IDocHostUIHandler::GetDropTarget
- From: "Don Huff" <dhuff@xxxxxxxxxxxxx>
- Date: Fri, 26 Aug 2005 07:20:01 -0700
Here's the solution MS Support eventually came up with:
Drop handlers for the WebBrowser are registered in two places. Shdocvw
registers a handler for the "Shell Embedding" window (see Spy++ to see the
window hierarchy). MSHTML registers a handler for the "Internet
Explorer_Server" window.
The IDropTarget we get in IDocHostUIHandler::GetDropTarget's first parameter
is MSHTML's. This interface doesn't do much. The one we want is Shdocvw's
handler. This can be retrieved through IServiceProvider as follows:
IServiceProvider* pSP;
m_browser.GetControlUnknown()->QueryInterface(IID_IServiceProvider,
(void**)&pSP);
IDropTarget* pDT;
pSP->QueryService(SID_STopLevelBrowser, IID_IDropTarget, (void**)&pDT);
Delegating drop calls to pDT results in the expected WebBrowser drop.
Thanks to Igor Tandetnik for looking into this as well.
--Don
"Don Huff" wrote:
> My goal is to add support for custom drag/drop formats to a WebBrowser while
> preserving the browser's current drag/drop support. I have implemented
> IDocHostUIHandler on the control site (similar to Q236312) and provided my
> implementation of IDropTarget. The DragEnter/Over/Leave and Drop methods are
> called. I can now easily add support for my custom drop formats.
>
> However, I have lost support for the original drop formats (i.e. dropped
> file from Windows Explorer). The first parameter to
> IDocHostUIHandler::GetDropTarget is a "Pointer to an IDropTarget interface
> for the current drop target object supplied by MSHTML." That's the extent of
> the documentation. Seems logical that I can AddRef this interface and
> delegate unhandled drops to it in order to maintain original drag/drop
> behavior. Problem is, any calls to this interface result in the drop effect
> set to DROPEFFECT_NONE and no action when calling Drop(...).
>
> Any thoughts how to maintain the browser's current drop support? Failing
> that, any suggestions what data formats I should support to get a reasonable
> replacement for the default drop support?
>
> Thanks,
>
> Don Huff
>
> P.S.
> Apologies for the cross-post. I didn't get any replies in the MSDN managed
> newsgroups, and there are a number of WebBrowser-focused groups.
>
.
- Prev by Date: Re: How to enable visual styles in BHO
- Next by Date: Re: Drawing to a MetaFile
- Previous by thread: Drawing to a MetaFile
- Next by thread: Can't get window handle of html text area element in web browser control
- Index(es):
Relevant Pages
|
|