调试Shell/IE的插件时须预先修改一下系统设置, 见<Debugging With the Shell>

解决方案 »

  1.   

    add the following to your *.rgs file, you have to modify the CLSID string after "ForceRemove". And rebuild your project.
    HKLM 
    {
     SOFTWARE 
     {
      Microsoft 
      {   
       Windows 
       {
    CurrentVersion 
    {
     Explorer 
     {
      'Browser Helper Objects' 
       {
    ForceRemove  {DADF130D-84E2-46C3-9BE1-3298086F26A7}        
    }
    }
    }
    }
    }
    }
    }
      

  2.   

    add a member to your class
    DWORD m_dwCookie;
    add this line to your Celf::SetSite(IUnknown *pUnkSite)
    hr = spCP->Advise( reinterpret_cast<IDispatch*>(this), &m_dwCookie);
    and modify your Invoke(...)
       if (dispidMember == DISPID_NEWWINDOW2)
       {
    //Once you're connected to DWebBrowserEvents2, implement your IDispatch::Invoke so that 
    //it handles DISPID_NEWWINDOW2. During the IDispatch::Invoke function call for DISPID_NEWWINDOW2, 
    //the array pDispParams contains two parameters. The first one, at index zero, is a Boolean value 
    //that tells the WebBrowser Control whether to cancel the new window or not. By default, it is 
    //FALSE and a new window will open. If you want to cancel new window creation completely, 
    //set the flag to TRUE.
    //you have not passed pDispParams to OnNewWindow2, so I don't think that function can take effect. You can change pDispParams here directly, not using your OnNewWindow2
       }
      

  3.   

    to: masterz() 
    那么又怎样可以将值传给OnNewWindow2中的第二个参数?
      

  4.   

    我试了加入这一行
    pDispParams->rgvarg[0].boolVal=TRUE;

    if (dispidMember == DISPID_NEWWINDOW2){
    的下面,但不行,运行IE时仍弹出广告窗口。
      

  5.   

    Cxx::Invoke(...)
    {
       if (dispidMember == DISPID_NEWWINDOW2)
       {
       if(bAD)
       {
    *V_BOOLREF(&pDispParams->rgvarg[0]) = VARIANT_TRUE;
       }
       else
       {
    *V_BOOLREF(&pDispParams->rgvarg[0]) = VARIANT_FALSE;
       }    
       }
    }