VC中WebBrowser控件如何显示html文件,可以直接显示字符串吗???
里面好像有个accNavigate,但不知它是如何和HTML文件绑定的

解决方案 »

  1.   

    没有这个方法啊,添加后的类是CExplore1
      

  2.   

    你可以试一下CHtmlView类,很好用
      

  3.   

    我试过使用CHtmlView的继承类,但它只能显示存为resource的html(通过资源ID)
    CExplore1的基类是CWnd,都没有Navigate方法,CWND有个accNavigate方法,不好用啊
      

  4.   

    accXXX之类的方法都是跟IAccessible接口相关的,这是DirectUI的基础,accNavigate只是用于DirectUI窗口内部子窗口的导航定位操作,跟浏览器控件无关。CExplore1虽然是从CWnd继承的,但是既然作为容纳浏览器控件的容器窗口,就肯定能通过GetControlUnknown获得浏览器控件的:
    LPUNKNOWN pUnk = CExplore1::GetControlUnknown();
    CComQIPtr<IWebBrowser2> spWb = pUnk;
    spWb->Navigate2(...)
      

  5.   

    请问楼上:
    我用你的代码,在控件的界面上显示如下,用CHtmlView的Navigate2也出现同样的问题?
    Action canceled 
    Internet Explorer was unable to link to the Web page you requested. The page might be temporarily unavailable.
    Please try the following:
    Click the  Refresh button, or try again later.
    If you have visited this page previously and you want to view what has been stored on your computer, click File, and then click Work Offline.
    For information about offline browsing with Internet Explorer, click the Help menu, and then click Contents and Index.
    Internet Explorer