use of undefined type IShellWindows

lxc_csdd 2012-12-03 10:14:14
在网上找一段找码,编译CComPtr<IShellWindows> spShellWin;的时候不能通过
错误信息:

--------------------Configuration: setwebtext - Win32 Debug--------------------
Compiling...
setwebtext.cpp
d:\program files (x86)\microsoft visual studio\vc98\atl\include\atlbase.h(445) : error C2027: use of undefined type 'IShellWindows'
d:\program files (x86)\microsoft visual studio\vc98\include\comdef.h(452) : see declaration of 'IShellWindows'
d:\program files (x86)\microsoft visual studio\vc98\atl\include\atlbase.h(443) : while compiling class-template member function '__thiscall ATL::CComPtr<struct IShellWindows>::~ATL::CComPtr<struct IShellWindows>(void)'
d:\program files (x86)\microsoft visual studio\vc98\atl\include\atlbase.h(445) : error C2227: left of '->Release' must point to class/struct/union
d:\program files (x86)\microsoft visual studio\vc98\atl\include\atlbase.h(443) : while compiling class-template member function '__thiscall ATL::CComPtr<struct IShellWindows>::~ATL::CComPtr<struct IShellWindows>(void)'
执行 cl.exe 时出错.

setwebtext.exe - 1 error(s), 0 warning(s)





--------------------------
代码
#include "stdafx.h"
#include "afx.h"
#include <atlbase.h>
#include <mshtml.h>
#include <winuser.h>
#include <comdef.h>
#include <string>

void EnumIE(void);//处理网页
void EnumFrame(IHTMLDocument2 * pIHTMLDocument2);//处理框架
void EnumForm(IHTMLDocument2 * pIHTMLDocument2);//处理表单

CComModule _Module; //使用CComDispatchDriver ATL的智能指针,此处必须声明
#include <atlcom.h>
void EnumField(CComDispatchDriver spInputElement,CString ComType,CString ComVal,CString ComName);//处理表单域

void EnumIE(void)
{
CComPtr<IShellWindows> spShellWin;
//HRESULT hr=spShellWin.CoCreateInstance(CLSID_ShellWindows);
}
...全文
125 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
Coder_Y_Jao 2012-12-04
  • 打赏
  • 举报
回复
加上楼上的头文件。
Coder_Y_Jao 2012-12-04
  • 打赏
  • 举报
回复

#include <Exdisp.h>
ri_aje 2012-12-03
  • 打赏
  • 举报
回复
说的是 IShellWindows 没有定义,是不是忘记什么头文件了?

64,639

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧