描述:
一直以为 com 接口不能继承, 最近开到一个com控件, 用 ATL 实现的继承..
oleView中到
[
odl,
uuid(36971202-D715-4AFC-83D4-7C0DDD8872E8),
helpstring("IGRGroupHeader Interface"),
dual,
nonextensible,
oleautomation
]
interface IGRGroupSection : IGRSection {
[id(0x00000066), propget, helpstring("property KeepTogether")]
想在 vc2008 mfc 中实现这样的功能, 接口继承, 今天调试了一下午也没有结果 那位做过这个方面, 期待你的解答....
我在mfc 创建的工程中使用了 ATL 还是不行,
[
object,
uuid(3BF55842-9169-402D-8A21-C8B14182C3F1),
dual,
nonextensible,
helpstring("IAtl2 Interface"),
pointer_default(unique)
]
interface IAtl2 : IDispatch{
[id(1), helpstring("method Test")] HRESULT TestBase(void);
};
[
object,
uuid(AEDC07DF-F496-4F84-969B-555E88572325),
dual,
nonextensible,
helpstring("IAtl3 Interface"),
pointer_default(unique)
]
interface IAtl3 : IAtl2{
[id(1), helpstring("method Test")] HRESULT Test(void);
};
报错: ::
error MIDL2020 : error generating type library : LayOut failed : IAtl3 (0x800288C6)
解决方案1:
完全看不懂,过来抢沙发也没抢着,就踩一脚了。
解决方案2:两个接口方法的ID怎么都是1?基类已经用了1,派生接口就要用别的
解决方案3: The error means you are using dual or oleautomation attributes for your interface while there are method signatures do not conform with oleautomation requirement.
For oleautomation requirement you can reference MSDN.