我做了一个MFC对话框浏览器 CWebBrowser2 m_web;
 为什么m_web.Navigate2("http://www.sina.com",NULL,NULL,NULL,NULL);这句编译出错但是m_web.Navigate("http://www.sina.com",NULL,NULL,NULL,NULL);这样就是对的?
那么m_web.Navigate2()里面的参数应该如何呢?

解决方案 »

  1.   

    error C2664: 'Navigate2' : cannot convert parameter 1 from 'char [20]' to 'struct tagVARIANT *'
            Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
      

  2.   

    Navigate2 第一个参数 是个变量啊 可是我怎么把常量的地址传给他啊
      

  3.   

    http://topic.csdn.net/t/20030122/17/1383965.html
      

  4.   

    纠结了一下午 
    #include <comdef.h>CString str("http://www.baidu.com");
    VARIANT var;
    var.vt = VT_BSTR;
    var.bstrVal = _bstr_t((LPCTSTR)str);
    感谢各位!散分!