建立atl组件,刚创建一个new ATL object 就编译出错!
EGIN_COM_MAP(CCatInformation)
----→错误 COM_INTERFACE_ENTRY(ICatInformation)
----→错误 COM_INTERFACE_ENTRY(IDispatch)
END_COM_MAP()提示:
e:\学习\练习\computer\computer\catinformation.h(26) : error C2440: 'static_cast' : cannot convert from 'class CCatInformation *' to 'struct IDispatch *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
e:\学习\练习\computer\computer\catinformation.h(26) : error C2440: 'initializing' : cannot convert from 'long (__stdcall *)(void *,const struct _GUID &,void ** ,unsigned long)' to 'unsigned long'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
CatInformation.cpp
e:\学习\练习\computer\computer\catinformation.h(26) : error C2440: 'static_cast' : cannot convert from 'class CCatInformation *' to 'struct IDispatch *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
e:\学习\练习\computer\computer\catinformation.h(26) : error C2440: 'initializing' : cannot convert from 'long (__stdcall *)(void *,const struct _GUID &,void ** ,unsigned long)' to 'unsigned long'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
Generating Code...
Error executing cl.exe.computer.dll - 4 error(s), 0 warning(s)
EGIN_COM_MAP(CCatInformation)
----→错误 COM_INTERFACE_ENTRY(ICatInformation)
----→错误 COM_INTERFACE_ENTRY(IDispatch)
END_COM_MAP()提示:
e:\学习\练习\computer\computer\catinformation.h(26) : error C2440: 'static_cast' : cannot convert from 'class CCatInformation *' to 'struct IDispatch *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
e:\学习\练习\computer\computer\catinformation.h(26) : error C2440: 'initializing' : cannot convert from 'long (__stdcall *)(void *,const struct _GUID &,void ** ,unsigned long)' to 'unsigned long'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
CatInformation.cpp
e:\学习\练习\computer\computer\catinformation.h(26) : error C2440: 'static_cast' : cannot convert from 'class CCatInformation *' to 'struct IDispatch *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
e:\学习\练习\computer\computer\catinformation.h(26) : error C2440: 'initializing' : cannot convert from 'long (__stdcall *)(void *,const struct _GUID &,void ** ,unsigned long)' to 'unsigned long'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
Generating Code...
Error executing cl.exe.computer.dll - 4 error(s), 0 warning(s)
解决方案 »
- 如何查找别的程序,窗体里控件的句柄。
- 创建一次DOM,是否可以加载多个文件呢?
- 每隔0.5秒从服务器数据库的TabA表中提数据刷新客户端界面上的MSHFlexGrid1控件。有24个客户端,TabA表中的记录由于各个客户端的操作而频繁变动,变动的范围为0~2000条左右记录,请审查这个方案是否可行。见主要代码:
- 请教遥感图像文件的通道类型的由来
- 100分,一个简单问题!
- COM 还有戏吗
- 关于UUID的问题!
- 如何用CDATABASE与CRECORDSET通过ODBC调用数据库?
- 请大家推荐一个好的二进制编辑器,最好不要注册。谢谢了先!!!
- 急问!vc打印问题!
- 基于VC平台的ActiveX控件设计与开发
- 读取硬盘上的.bmp 文件,并且全屏显示
COM_INTERFACE_ENTRY(ICatInformation)
COM_INTERFACE_ENTRY2(IDispatch, ICatInformation) // IDispatch接口不能直接被请求,要映射到某个具体接口
END_COM_MAP()
// CatInformation.h : Declaration of the CCatInformation#ifndef __CATINFORMATION_H_
#define __CATINFORMATION_H_#include "resource.h" // main symbols/////////////////////////////////////////////////////////////////////////////
// CCatInformation
class ATL_NO_VTABLE CCatInformation :
public CComObjectRootEx<CComSingleThreadModel>,
public CComCoClass<CCatInformation, &CLSID_CatInformation>,
public IDispatchImpl<ICatInformation, &IID_ICatInformation, &LIBID_COMPUTERLib>
{
public:
CCatInformation()
{
}DECLARE_REGISTRY_RESOURCEID(IDR_CATINFORMATION)DECLARE_PROTECT_FINAL_CONSTRUCT()BEGIN_COM_MAP(CCatInformation)
COM_INTERFACE_ENTRY(ICatInformation)
COM_INTERFACE_ENTRY(IDispatch)
END_COM_MAP()// ICatInformation
public:
};#endif //__CATINFORMATION_H_