Vs2010 Atl工程手工添加连接点
2013-08-11 12:26
176 查看
背景:
新建Atl工程:atlTT
添加ATL Simple Object:SimpleEvent,不选择支持连接点
修改atlTT.idl,摘录如下,红色为手工添加的部分
library atlTTLib
{
importlib("stdole2.tlb");
[
uuid(F6223641-CD95-44CF-B121-9DA1CC416522)
]
dispinterface _ISimpleEventEvents
{
properties:
methods:
[id(1)] HRESULT OnAdd(LONG lValue);
};
[
uuid(B7560BBD-7D1D-4082-8AD4-A5DD35633E1C)
]
coclass SimpleEvent
{
[default] interface ISimpleEvent;
[default, source] dispinterface _ISimpleEventEvents;
};
};
先编译工程,再在Class View中通过右键菜单"Add Connection Point…",添加连接点实现,如下图。
注意点:1、选择菜单"Add Connection Point…",而非"Implement Interface…"
2、对话框中,Availabel type library列表选择"atlTTlib<1.0>",而非"Embedded IDL"
点击按钮"Finish",然后在Solution Explorer中就能看到新生成的文件"_ISimpleEventEvents_CP.h",文件中有"HRESULT Fire_OnAdd(LONG lValue)"的实现,触发事件只要调用Fire_OnAdd。
深入解析连接点(还未细看,介绍了使用连接点来进行进程间通信)
http://blog.csdn.net/debehe/article/details/2291771
新建Atl工程:atlTT
添加ATL Simple Object:SimpleEvent,不选择支持连接点
修改atlTT.idl,摘录如下,红色为手工添加的部分
library atlTTLib
{
importlib("stdole2.tlb");
[
uuid(F6223641-CD95-44CF-B121-9DA1CC416522)
]
dispinterface _ISimpleEventEvents
{
properties:
methods:
[id(1)] HRESULT OnAdd(LONG lValue);
};
[
uuid(B7560BBD-7D1D-4082-8AD4-A5DD35633E1C)
]
coclass SimpleEvent
{
[default] interface ISimpleEvent;
[default, source] dispinterface _ISimpleEventEvents;
};
};
先编译工程,再在Class View中通过右键菜单"Add Connection Point…",添加连接点实现,如下图。
注意点:1、选择菜单"Add Connection Point…",而非"Implement Interface…"
2、对话框中,Availabel type library列表选择"atlTTlib<1.0>",而非"Embedded IDL"
点击按钮"Finish",然后在Solution Explorer中就能看到新生成的文件"_ISimpleEventEvents_CP.h",文件中有"HRESULT Fire_OnAdd(LONG lValue)"的实现,触发事件只要调用Fire_OnAdd。
深入解析连接点(还未细看,介绍了使用连接点来进行进程间通信)
http://blog.csdn.net/debehe/article/details/2291771
相关文章推荐
- ATL中手工添加连接点事件的方法 【转】
- ATL 工程下添加右击菜单
- 使用VS2010创建MFC工程,并添加VTK引用
- VS2010在资源管理器中添加工程
- VS2010, WPF工程添加图片资源
- 给VS2010添加对所有工程都起作用的默认INCLUDE包含路径
- ATL--创建简单的ATL之dll工程,添加“ATL简单对象”类的参数说明
- ATL 工程下添加右击菜单
- VS2010工程添加第三方库 方法 win32 dll
- VS2010添加默认路径和库,新工程无需手动添加
- VS2010, WPF工程添加图片资源
- VS2010创建ATL工程及使用C++测试COM组件
- ATL--创建简单的ATL之dll工程,添加类和类的接口并在MFC中调用
- 在vs2010 添加Gtest 测试框架X86 到x64 工程建立: 步骤 1. 先编译Gtest源码,生成DEBUG 版本"gtestd.lib"与RELEASE版本"gtest.lib"。此处不明
- ATL--创建简单的ATL之dll工程,给接口添加属性(实际上就是一个函数对)
- 在MFC工程中添加ATL
- 使用ATL创建简单ActiveX控件(三) —— 添加连接点
- 为ATL工程添加一个固有属性:
- VC6.0和VS2010工程大小区别
- VS2010如何添加MSCOMM控件