接口不能从非接口的IDispatch继承
Interface cannot inherit from non-Interface IDispatch
我是一个c++新手(从1.0测试版开始就在做c#)。我被分配将一个小的c++解决方案从VS 2005升级到VS 2015(它生成一个。ocx文件)。到目前为止,大部分都很好,除了一段疯了。
我有错误"接口类'IEmail'不能从非接口类'IDispatch'继承"
__interface IEmail : IDispatch
{
[id(1), helpstring("method Send")] HRESULT Send(BSTR SenderName, BSTR Sender, BSTR Recipient, BSTR Subject, BSTR Message,BSTR Server);
[id(2), helpstring("method Shutdown")] HRESULT Shutdown(void);
[id(3), helpstring("method Listen")] HRESULT Listen(BSTR Server, BSTR Account, BSTR Password);
[id(4), helpstring("method DebugMode")] HRESULT DebugMode(LONG nMode);
};
IDispatch被定义为
typedef interface IDispatch IDispatch;
谁能告诉我如何得到什么旧代码是完成,再次工作?(简单地用c++语言解释给我听,可能行不通)
vc++有一些扩展,包括c++的代码属性系统,可以直接从c++代码中生成COM类型信息。作为这些扩展的一部分,__interface
标识了一个纯虚拟类,它是一个COM接口。
这不是一个托管接口,这是一个非托管接口:https://msdn.microsoft.com/en-us/library/50h7kwtb(v=vs.80).aspx
简而言之,__interface
是正确的,而interface
不是。因为你有那个typedef,它看起来像一些编译器选项或编译标志是错误的,它试图编译托管c++/CLR代码。
相关文章:
- C++核心准则 C35 对于接口类"A base class destructor should be either public and virtual, or protected and nonv
- Visual C++GC接口如何启用它以及要包含哪个库
- Windows.h与GLFW.h的接口
- 当字段可以为null时,如何使用C++接口在Avro中写入数据
- 提供与TMP和SFINAE的通用接口
- 为重写std::exception的库生成swig接口时出错
- 内联如何影响模块接口中的成员函数
- COM 接口 c# 封送数组数组
- 如何在 SCIP C++ 接口中获取 MILP 约束矩阵中的系数值
- 重载 -> shared_ptr 个实例中的箭头运算符<interface>,接口中没有纯虚拟析构函数
- 如何绑定 C++ gRPC 客户端的网络接口
- 模板化接口 - 创建一个泛型模板类以返回任何容器
- 如何从实现接口的模板化类实例访问结构
- 带有进度表的 curl 多接口程序
- 设计帮助 - 为不同类型的消息处理通用接口的设计模式
- 我可以在具有一个标头和一个接口的 cpp 文件中有多个嵌入吗?
- "IDispatch::GetTypeInfo()"接口是否正常
- 封送C#类型以调用C++IDispatch接口会导致类型不匹配
- IDispatch::Invoke(DISPATCH_PROPERTYGET)是否增加返回的IDispatch接口的引用
- 接口不能从非接口的IDispatch继承