使用ocx(host ocx)
来源:互联网 发布:金融网络销售靠谱吗 编辑:程序博客网 时间:2024/04/30 15:09
使用ocx(host ocx):
1、导入类型库
#import "some.dll" raw_interface_only named_guids
#import "some.ocx" raw_interface_only named_guids
#import语句会自动生成tli和tlh文件。
2、声明IDispEventImpl接口
public IDispEventImpl<ExtObjID, MyClass, &DIID_IExtEvents, &LIBID_ExtEventsLib, majorVer, minorVer>
ExtObjID: 如果不是复合控件,为arbitrary id。否则为资源ID。
DIID_IExtEvents:对应为tlh中的dispinterface id。
LIBID_ExtEventsLib:对应tlh中的lib id。
majorVer, minorVer: 通过OLE/COM Object Viewer中的ITypeLib Viewer查看。
*****DIID_IExtEvents和LIBID_ExtEventsLib都是在MyClass.cpp文件中定义和初始化,在MyClass.h文件中做extern声明来使用。
否则会提示错误:error C2970: 'ATL::IDispEventImpl' : template parameter 'plibid' : 'LIBID_ShockwaveFlashObjects' : an
expression involving objects with internal linkage cannot be used as a non-type argument。
3、声明对事件接收的映射(映射事件的处理函数)
BEGIN_SINK_MAP(myClass)
SINK_ENTRY_EX(ExtObjID, DIID_IExtEvents, dispid, &MyClass::EnventHandler)
END_SINK_MAP()
dispid: 可通过OLE/COM Object Viewer中的ITypeLib Viewer查看。
4、通知和取消通知IDispEventImpl接口
Advise()\UnAdvise();
1、导入类型库
#import "some.dll" raw_interface_only named_guids
#import "some.ocx" raw_interface_only named_guids
#import语句会自动生成tli和tlh文件。
2、声明IDispEventImpl接口
public IDispEventImpl<ExtObjID, MyClass, &DIID_IExtEvents, &LIBID_ExtEventsLib, majorVer, minorVer>
ExtObjID: 如果不是复合控件,为arbitrary id。否则为资源ID。
DIID_IExtEvents:对应为tlh中的dispinterface id。
LIBID_ExtEventsLib:对应tlh中的lib id。
majorVer, minorVer: 通过OLE/COM Object Viewer中的ITypeLib Viewer查看。
*****DIID_IExtEvents和LIBID_ExtEventsLib都是在MyClass.cpp文件中定义和初始化,在MyClass.h文件中做extern声明来使用。
否则会提示错误:error C2970: 'ATL::IDispEventImpl' : template parameter 'plibid' : 'LIBID_ShockwaveFlashObjects' : an
expression involving objects with internal linkage cannot be used as a non-type argument。
3、声明对事件接收的映射(映射事件的处理函数)
BEGIN_SINK_MAP(myClass)
SINK_ENTRY_EX(ExtObjID, DIID_IExtEvents, dispid, &MyClass::EnventHandler)
END_SINK_MAP()
dispid: 可通过OLE/COM Object Viewer中的ITypeLib Viewer查看。
4、通知和取消通知IDispEventImpl接口
Advise()\UnAdvise();
- 使用ocx(host ocx)
- ocx 使用
- ocx使用
- ocx
- ocx
- ocx
- ocx
- ocx
- ocx
- 服务器使用 ocx (ocx增加安全属性接口)
- 在ie 中 使用 ocx (二)
- DSOFramer.ocx 控件使用
- MSCHRT20.OCX使用详解
- OCX使用IE调试
- 使用VS2005创建“OCX”
- MSCHRT20.OCX使用详解
- .ocx安装与使用
- WPF OCX(转)
- 使用autoit解决webdriver文件上传问题
- USACO 2.2.3 Runaround Numbers 循环数
- hdu1104Remainder (BFS)
- Struts2 <s:actionerror>标签覆盖
- 一道C机试题目
- 使用ocx(host ocx)
- ios开发第一篇 简单的qq登录窗口
- python优化
- rails 的 Helpers
- android 中写rom文件命名时一点小小的总结
- 【算法导论】C++参考源码之线性时间排序
- 黑马程序员—多线程(上)-线程及其创建方法
- Linux软件的安装、卸载
- Struts2<s:date>标签使用详解