先定制一个浏览器使用WebBrowser控件,
如果我们用IE浏览器上一些网站会弹出:此站点可能需要下列ActiveX控件:来自'aaaa'的'bbbbb软件'。单击此处安装...使用WebBrowser控件如何弹出呢?在线等!

解决方案 »

  1.   

    CComPtr <IHTMLDocument2> pHTMLDoc2;  
    pDisp->QueryInterface(IID_IHTMLDocument2, (void**)&pHTMLDoc2);  
    CComPtr <IHTMLElementCollection> pAllElements;  
    HRESULT hr = pHTMLDoc2->get_all(&pAllElements);然后IHTMLElementCollection::tagsHRESULT tags(          VARIANT tagName,
        IDispatch **pdisp
    );得到IHTMLElementCollection的IDispatch 接口指针。 再从IDispath中QueryInterface得到另外一个IHTMLElementCollection
    CComPtr<IHTMLElementCollection> pAllElements;
    HRESULT hr = pHTMLDoc2->get_all(&pAllElements);
    if (SUCCEEDED(hr))
    {
    CComVariant vTemp("object");
    CComPtr <IDispatch> pDisp3;  
    hr = pAllElements->tags(vTemp,&pDisp3);
    if (SUCCEEDED(hr))
    {
      CComPtr<IHTMLElementCollection> pObjectElements;
    pDisp3->QueryInterface(IID_IHTMLElementCollection,(void**)&pObjectElements);
      long nNumElements;
    hr = pObjectElements->get_length(&nNumElements);
    if (SUCCEEDED(hr) && nNumElements)
    {
    for (int i=0;i<nNumElements;i++)
    {
    CComVariant varName(i);  
    varName.ChangeType(VT_UINT);  
    CComVariant varIndex;  
    CComPtr <IDispatch> pDisp2;  
    hr = pObjectElements->item(varName, varIndex, &pDisp2);  
    if (SUCCEEDED(hr))
    {
    CComQIPtr <IHTMLObjectElement, &IID_IHTMLObjectElement>pObjectElement(pDisp2);  
    CComBSTR cClassId;  
    pObjectElement->get_classid(&cClassId);  
    CComBSTR cName;  
    pObjectElement->get_name(&cName);  
    CComBSTR cCodeBase;  
    pObjectElement->get_codeBase(&cCodeBase);  
    CComBSTR PluginsInfo;  
    PluginsInfo.Append(cName);  
    PluginsInfo.Append(cClassId);  
    PluginsInfo.Append(cCodeBase);  
    pObjectElement.Release();  
    ::MessageBox(NULL,OLE2CT(PluginsInfo),NULL,MB_OK); 
    代码只是个思路,不一定对,你修改修改