为什么不能用,这不就是MFC代码吗?有CString和AfxMessageBox.
如生成不了,就是少东西。

解决方案 »

  1.   

    会产生如下错误:
    注:
     if(spBrowser!=NULL)
    {
    MessageBox("hehe");
    }
    else
    {
    AfxMessageBox(_T("aiaiaia"));
    }是我自己加的--------------------Configuration: Test - Win32 Debug--------------------
    Compiling...
    TestView.cpp
    D:\LIZARD\VC_TEMP\Test\TestView.cpp(84) : error C2653: 'SHDocVw' : is not a class or namespace name
    D:\LIZARD\VC_TEMP\Test\TestView.cpp(84) : error C2065: 'IShellWindowsPtr' : undeclared identifier
    D:\LIZARD\VC_TEMP\Test\TestView.cpp(84) : error C2146: syntax error : missing ';' before identifier 'm_spSHWindows'
    D:\LIZARD\VC_TEMP\Test\TestView.cpp(84) : error C2065: 'm_spSHWindows' : undeclared identifier
    D:\LIZARD\VC_TEMP\Test\TestView.cpp(87) : error C2228: left of '.CreateInstance' must have class/struct/union type
    D:\LIZARD\VC_TEMP\Test\TestView.cpp(87) : error C2653: 'SHDocVw' : is not a class or namespace name
    D:\LIZARD\VC_TEMP\Test\TestView.cpp(91) : error C2227: left of '->GetCount' must point to class/struct/union
    D:\LIZARD\VC_TEMP\Test\TestView.cpp(93) : error C2065: 'm_strWinCount' : undeclared identifier
    D:\LIZARD\VC_TEMP\Test\TestView.cpp(93) : error C2679: binary '=' : no operator defined which takes a right-hand operand of type 'class CString' (or there is no acceptable conversion)
    D:\LIZARD\VC_TEMP\Test\TestView.cpp(97) : error C2065: 'IDispatchPtr' : undeclared identifier
    D:\LIZARD\VC_TEMP\Test\TestView.cpp(97) : error C2146: syntax error : missing ';' before identifier 'spDisp'
    D:\LIZARD\VC_TEMP\Test\TestView.cpp(97) : error C2065: 'spDisp' : undeclared identifier
    D:\LIZARD\VC_TEMP\Test\TestView.cpp(98) : error C2143: syntax error : missing ';' before ')'
    D:\LIZARD\VC_TEMP\Test\TestView.cpp(100) : error C2065: '_variant_t' : undeclared identifier
    D:\LIZARD\VC_TEMP\Test\TestView.cpp(100) : error C2146: syntax error : missing ';' before identifier 'var'
    D:\LIZARD\VC_TEMP\Test\TestView.cpp(100) : error C2065: 'var' : undeclared identifier
    D:\LIZARD\VC_TEMP\Test\TestView.cpp(100) : error C2065: 'VT_14' : undeclared identifier
    D:\LIZARD\VC_TEMP\Test\TestView.cpp(101) : error C2227: left of '->Item' must point to class/struct/union
    D:\LIZARD\VC_TEMP\Test\TestView.cpp(103) : error C2653: 'SHDocVw' : is not a class or namespace name
    D:\LIZARD\VC_TEMP\Test\TestView.cpp(103) : error C2065: 'IWebBrowser2Ptr' : undeclared identifier
    D:\LIZARD\VC_TEMP\Test\TestView.cpp(103) : error C2146: syntax error : missing ';' before identifier 'spBrowser'
    D:\LIZARD\VC_TEMP\Test\TestView.cpp(103) : error C2065: 'spBrowser' : undeclared identifier
    Error executing cl.exe.Test.exe - 22 error(s), 0 warning(s)
      

  2.   

    这好像是ATL的代码,看看工程的环境变量加没加ATL的include和Lib
    代码相关的还有没有.h,加到工程的环境变量中。
      

  3.   


    SHDocVw::IShellWindowsPtr m_spSHWindows;
    之前先引入类型库
    #import "shdocvw.dll"
    再试试
      

  4.   

    我现在想知道他到底是不是mfc的~~
    还是mfc和atl都可以用~~
    谁告诉我~
      

  5.   

    跟MFC好象没有太大关系,关键是导入类型库
    否则那些接口指针没有定义,导入成功后会
    生成.tlh文件,那些抱错的东西在那里面定义
    的。建议你去看一本COM方面的书。