下面代码可以在mfc中用吗?谢谢 为什么不能用,这不就是MFC代码吗?有CString和AfxMessageBox.如生成不了,就是少东西。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 会产生如下错误:注: if(spBrowser!=NULL) { MessageBox("hehe"); } else { AfxMessageBox(_T("aiaiaia")); }是我自己加的--------------------Configuration: Test - Win32 Debug--------------------Compiling...TestView.cppD:\LIZARD\VC_TEMP\Test\TestView.cpp(84) : error C2653: 'SHDocVw' : is not a class or namespace nameD:\LIZARD\VC_TEMP\Test\TestView.cpp(84) : error C2065: 'IShellWindowsPtr' : undeclared identifierD:\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 identifierD:\LIZARD\VC_TEMP\Test\TestView.cpp(87) : error C2228: left of '.CreateInstance' must have class/struct/union typeD:\LIZARD\VC_TEMP\Test\TestView.cpp(87) : error C2653: 'SHDocVw' : is not a class or namespace nameD:\LIZARD\VC_TEMP\Test\TestView.cpp(91) : error C2227: left of '->GetCount' must point to class/struct/unionD:\LIZARD\VC_TEMP\Test\TestView.cpp(93) : error C2065: 'm_strWinCount' : undeclared identifierD:\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 identifierD:\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 identifierD:\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 identifierD:\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 identifierD:\LIZARD\VC_TEMP\Test\TestView.cpp(100) : error C2065: 'VT_14' : undeclared identifierD:\LIZARD\VC_TEMP\Test\TestView.cpp(101) : error C2227: left of '->Item' must point to class/struct/unionD:\LIZARD\VC_TEMP\Test\TestView.cpp(103) : error C2653: 'SHDocVw' : is not a class or namespace nameD:\LIZARD\VC_TEMP\Test\TestView.cpp(103) : error C2065: 'IWebBrowser2Ptr' : undeclared identifierD:\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 identifierError executing cl.exe.Test.exe - 22 error(s), 0 warning(s) 这好像是ATL的代码,看看工程的环境变量加没加ATL的include和Lib代码相关的还有没有.h,加到工程的环境变量中。 在SHDocVw::IShellWindowsPtr m_spSHWindows;之前先引入类型库#import "shdocvw.dll"再试试 我现在想知道他到底是不是mfc的~~还是mfc和atl都可以用~~谁告诉我~ 跟MFC好象没有太大关系,关键是导入类型库否则那些接口指针没有定义,导入成功后会生成.tlh文件,那些抱错的东西在那里面定义的。建议你去看一本COM方面的书。 窗口显示顺序//改变mainfame窗口显示的顺序为第二位 连续删除空目录会出错!_rmdir C# web非套打 打印问题 多个控件封装问题 我在VC6.0 IDE下绘制矩阵的影像图,如何调节GRB值进行填充? directx sdk中的common文件夹没有 新手请教。。 怎样在线程中使用SetTimer()? 求解决方案:httpsendrequest,错误码12002(ERROR_INTERNET_TIMEOUT)? 在WINDOWS下如何获得文字的点阵码? 有个数据库程序要做,谁干,佣金好谈 在两个CPP文件中都包含同样的.h文件时出现错误,是何原因?
注:
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)
代码相关的还有没有.h,加到工程的环境变量中。
SHDocVw::IShellWindowsPtr m_spSHWindows;
之前先引入类型库
#import "shdocvw.dll"
再试试
还是mfc和atl都可以用~~
谁告诉我~
否则那些接口指针没有定义,导入成功后会
生成.tlh文件,那些抱错的东西在那里面定义
的。建议你去看一本COM方面的书。