diff --git a/dlls/ieframe/dochost.c b/dlls/ieframe/dochost.c index b0d713b466a..a495292e250 100644 --- a/dlls/ieframe/dochost.c +++ b/dlls/ieframe/dochost.c @@ -582,6 +582,11 @@ void release_dochost_client(DocHost *This) IOleInPlaceFrame_Release(This->frame); This->frame = NULL; } + + if(This->olecmd) { + IOleCommandTarget_Release(This->olecmd); + This->olecmd = NULL; + } } static inline DocHost *impl_from_IOleCommandTarget(IOleCommandTarget *iface) diff --git a/dlls/ieframe/ieframe.h b/dlls/ieframe/ieframe.h index a83ff35c7e1..8a0b074873e 100644 --- a/dlls/ieframe/ieframe.h +++ b/dlls/ieframe/ieframe.h @@ -128,6 +128,7 @@ struct DocHost { IDispatch *client_disp; IDocHostUIHandler *hostui; IOleInPlaceFrame *frame; + IOleCommandTarget *olecmd; IUnknown *document; IOleDocumentView *view; diff --git a/dlls/ieframe/oleobject.c b/dlls/ieframe/oleobject.c index fb9e12f4793..3a75a71cdac 100644 --- a/dlls/ieframe/oleobject.c +++ b/dlls/ieframe/oleobject.c @@ -458,6 +458,7 @@ static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, LPOLECLIENTSITE { WebBrowser *This = impl_from_IOleObject(iface); IDocHostUIHandler *hostui; + IOleCommandTarget *olecmd; IOleContainer *container; IDispatch *disp; HRESULT hres; @@ -502,9 +503,19 @@ static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, LPOLECLIENTSITE ITargetContainer_Release(target_container); } + hres = IOleContainer_QueryInterface(container, &IID_IOleCommandTarget, (void**)&olecmd); + if(FAILED(hres)) + olecmd = NULL; + IOleContainer_Release(container); + }else { + hres = IOleClientSite_QueryInterface(This->client, &IID_IOleCommandTarget, (void**)&olecmd); + if(FAILED(hres)) + olecmd = NULL; } + This->doc_host.olecmd = olecmd; + create_shell_embedding_hwnd(This); on_offlineconnected_change(This); diff --git a/dlls/ieframe/webbrowser.c b/dlls/ieframe/webbrowser.c index 1f58bbb199f..8689c7edee6 100644 --- a/dlls/ieframe/webbrowser.c +++ b/dlls/ieframe/webbrowser.c @@ -1206,33 +1206,17 @@ static HRESULT WINAPI DocHostContainer_SetStatusText(DocHost* This, LPCWSTR text static void WINAPI DocHostContainer_SetURL(DocHost* This, LPCWSTR url) { - } static HRESULT DocHostContainer_exec(DocHost *doc_host, const GUID *cmd_group, DWORD cmdid, DWORD execopt, VARIANT *in, VARIANT *out) { - WebBrowser *This = impl_from_DocHost(doc_host); - IOleCommandTarget *cmdtrg = NULL; HRESULT hres; - if(This->client) { - hres = IOleClientSite_QueryInterface(This->client, &IID_IOleCommandTarget, (void**)&cmdtrg); - if(FAILED(hres)) - cmdtrg = NULL; - } - - if(!cmdtrg && This->container) { - hres = IOleContainer_QueryInterface(This->container, &IID_IOleCommandTarget, (void**)&cmdtrg); - if(FAILED(hres)) - cmdtrg = NULL; - } - - if(!cmdtrg) + if(!doc_host->olecmd) return E_NOTIMPL; - hres = IOleCommandTarget_Exec(cmdtrg, cmd_group, cmdid, execopt, in, out); - IOleCommandTarget_Release(cmdtrg); + hres = IOleCommandTarget_Exec(doc_host->olecmd, cmd_group, cmdid, execopt, in, out); if(SUCCEEDED(hres)) TRACE("Exec returned %08x %s\n", hres, debugstr_variant(out)); else