我在bho中的SetSite方法中注册了RegisterNameSpace    
                       nResult  =  ::CoGetClassObject(CLSID_HTMLFilter,CLSCTX_SERVER,NULL,IID_IClassFactory,(void**)&m_pFactory);  
                       if(SUCCEEDED(nResult))  
                       {  
                                   nResult=::CoInternetGetSession(0,&m_pSession,0);  
                                   if(SUCCEEDED(nResult))  
                                   {  
                                               m_pSession->RegisterNameSpace(m_pFactory,  CLSID_HTMLFilter,  L"http",  0,  NULL,  0);  
                                   }  
                       }  
 
然后由新建了一个atl类  
class  ATL_NO_VTABLE  CHTMLFilter  :  
           public  CComObjectRootEx<CComSingleThreadModel>,  
           public  CComCoClass<CHTMLFilter,  &CLSID_HTMLFilter>,  
           public  IDispatchImpl<IHTMLFilter,  &IID_IHTMLFilter,  &LIBID_QuickNetLib,  /*wMajor  =*/  1,  /*wMinor  =*/  1>,  
           public  IInternetProtocol,  
           public  IInternetProtocolInfo  
注册没有问题,也调用到了  IInternetProtocol::Start  方法,但是Start方法如果返回值INET_E_USE_DEFAULT_PROTOCOLHANDLER  浏览器便崩溃了  
 
iexplore.exe  中的  0x762512b5  处未处理的异常:  0xC0000005:  读取位置  0xfeeefef6  时发生访问冲突  
 
我注册  RegisterMimeFilter  就没有问题,我用的  IE7  
 
另外问一下拿到页面的源文件后如何高效判断页面的编码?

解决方案 »

  1.   

    检查一下RegisterNameSpace的返回值。
      

  2.   

    返回值 0, 因为调到了 IInternetProtocol::Start 所以我觉得这一步应该没问题
    有没有 RegisterNameSpace 的例程? 我想用这个功能实现过滤url
      

  3.   

    我试了一下 可是 StartEx 方法调不到
      

  4.   

    如果返回值INET_E_USE_DEFAULT_PROTOCOLHANDLER     浏览器便崩溃了
    我也遇到这个问题了
      

  5.   

    nResult     =     ::CoGetClassObject(CLSID_HTMLFilter,CLSCTX_SERVER,NULL,IID_IClassFactory,(void**)&m_pFactory); 
    这句话只是去取m_pFactory,但是这个时候还没有创建呢。
    应该是这样:
    typedef  CComObject<MSIECore::CMSIEWinInetDelegate>::_ClassFactoryCreatorClass CMSIEWinInetDelegateCF;
            IClassFactory *pCF = NULL;
            CMSIEWinInetDelegateCF::CreateInstance(CComObject<MSIECore::CMSIEWinInetDelegate>::_CreatorClass::CreateInstance, IID_IClassFactory, (void**)&pCF);
            IInternetSession *pIInternetSession = NULL;
            CoInternetGetSession(0, &pIInternetSession, 0);
            pIInternetSession->RegisterNameSpace(pCF, IID_IInternetProtocol, L"http", 0, 0, 0);