4

I have this code and it not works:

template <const GUID* pFbCLSID, const char* pMT, class ICurObjInt,
    const IID* piid, const GUID* plibid>
STDMETHODIMP CFBControl<pFbCLSID, pMT,ICurObjInt,piid,plibid>::SetClientSite(
    IOleClientSite *pClientSite )
{
    HRESULT hr = IOleObjectImpl<CFBControlX>::SetClientSite (pClientSite);
    if (!pClientSite || !pluginMain) {
        shutdown();
        return hr;
    }

    m_serviceProvider = pClientSite;
    if (!m_serviceProvider)
        return E_FAIL;
    // HERE QueryService() return E_NOINTERFACE
    m_serviceProvider->QueryService(SID_SWebBrowserApp, IID_IWebBrowser2,
        reinterpret_cast<void**>(&m_webBrowser));
    m_serviceProvider.Release();
}

QueryService() returns E_NOINTERFACE. It is a firebreath (www.firebreath.org) plugin for IE and it loads dynamically. When DWebBrowserEvents2::OnDocumentComplete2() event is raised in my BHO I am inserting JS object of plugin and it calls the code above.

In my BHO I have the same code when I am subscribing to events and it works fine.

sharptooth
  • 167,383
  • 100
  • 513
  • 979
fryme
  • 281
  • 4
  • 15
  • Try querying for `SID_STopLevelBrowser`, `SID_SContainerDispatch`, `SID_STopWindow` services. Request `IUnknown`, then do `QueryService` on it for `SID_SWebBrowserApp` (just an idea - I haven't tried that). – noseratio Sep 24 '13 at 04:47
  • It may be that the request is initially completed okay and then the interface can't be marshalled back - http://stackoverflow.com/q/1781906/57428 http://stackoverflow.com/q/1108774/57428 http://stackoverflow.com/q/16590106/57428 This is just a guess, but this often happens when you have the same code working in one configuration and not in another. – sharptooth Sep 24 '13 at 06:43
  • Noseration, all that queries of interfaces returns E_NOINTERFACE. – fryme Sep 24 '13 at 07:52
  • Problem solved. Thanks to everybody for help. – fryme Sep 24 '13 at 08:56
  • What exactly was the problem? – sharptooth Sep 24 '13 at 10:15
  • 1
    I got in to same scenario. Could you please share the solution? – MGR Sep 15 '14 at 11:09

0 Answers0