1

Topic: Connection to IDocHostUIHandler through ICustomDoc-> SetUIHandler

Hello. It is impossible to be connected to the created class IDocHostUIHandler through SetUIHandler. Here the code: HRESULT onDocumentComplete (IDispatch *pDisp, VARIANT *vUrl) {IServiceProvider* spSP = NULL; HRESULT hRes = pDisp-> QueryInterface (IID_IServiceProvider, (void **) &spSP); if (SUCCEEDED (hRes)) {IServiceProvider* spSPTop = NULL; hRes = spSP-> QueryService (SID_STopLevelBrowser, IID_IServiceProvider, (void **) &spSPTop); if (SUCCEEDED (hRes)) {IWebBrowser2* spBrowser = NULL; hRes = spSPTop-> QueryService (SID_SWebBrowserApp, IID_IWebBrowser2, (void **) &spBrowser); if (SUCCEEDED (hRes)) {IDispatch* pHTMLDocDisp = NULL; hRes = spBrowser-> get_Document (&pHTMLDocDisp); if (SUCCEEDED (hRes)) {IHTMLDocument2* pHTMLDoc = NULL; hRes = pHTMLDocDisp-> QueryInterface (IID_IHTMLDocument2, (void **) &pHTMLDoc); if (SUCCEEDED (hRes)) {ICustomDoc* pCustom = NULL; hRes = pHTMLDocDisp-> QueryInterface (IID_ICustomDoc, (void **) &pCustom); if (SUCCEEDED (hRes)) {MyDocHandler* mydochandler = new MyDocHandler; pCustom-> SetUIHandler (mydochandler); pCustom-> Release ();} pHTMLDoc-> Release ();} pHTMLDocDisp-> Release ();} spBrowser-> Release ();} spSPTop-> Release ();} spSP-> Release ();} return hRes;} the Error in line: hRes = pHTMLDocDisp-> QueryInterface (IID_ICustomDoc, (void **) &pCustom); Error status code: E_NOINTERFACE No such interface supported. Help please