谁能讲讲这个函数InvokeHelper
来源:百度文库 编辑:神马文学网 时间:2024/07/03 12:36:47
当在项目中插入ActiveX控件ClassWizard生成的CWnd的派生类C++类中,可以看到其成员函数的代码中都有对InvokeHelper函数的调用,InvokeHelper函数的第一个参数都和对应的属性或方法在ActiveX控件中的分发(dispatch)ID(标识ActiveX控件的方法或属性的)相对应。通过查看ActiveX控件hlp文件可以发现,ActiveX控件的方法在生存的C++类中都有同名的成员函数与之对应,ActiveX控件的属性都有一组Get和Set函数对其操作,其中ActiveX控件的方法和属性操作与生成的C++类成员函数相关联都是通过InvokeHelper函数的调用来完成的,InvokeHelper函数的第一个参数是由 Component Gallery(控件提供者)提供的。因为经过这样的处理,所以我们如果要调用ActiveX控件的方法或对其属性进行取和设置操作,只需调用生成的 C++类对应的成员函数便可。
下面对InvokeHelper单独说明:
CWnd::InvokeHelper
void InvokeHelper( DISPID dwDispID, WORD wFlags, VARTYPE vtRet, void* pvRet, const BYTE* pbParamInfo, ... );
说明:
Call this member function to invoke the OLE control method or property specified by dwDispID, in the context specified by wFlags.
其中参数:
dwDispID:
//Identifies the method or property to be invoked. This value is usually supplied by Component Gallery.
wFlags:可以为下面些值,指明调用InvokeHelper的目的。
//[ DISPATCH_METHOD ] The member is invoked as a method. If a property has the same name, both this and the DISPATCH_PROPERTYGET flag may be set.
[ DISPATCH_PROPERTYGET ] The member is retrieved as a property or data member.
[ DISPATCH_PROPERTYPUT ] The member is changed as a property or data member.
[ DISPATCH_PROPERTYPUTREF ] The member is changed by a reference assignment, rather than a value assignment. This flag is valid only when the property accepts a reference to an object.
vtRet:
//Specifies the type of the return value.
VT_EMPTY void
VT_I2 short
VT_I4 long
VT_R4 float
VT_R8 double
VT_CY CY
VT_DATE DATE
VT_BSTR BSTR
VT_DISPATCH LPDISPATCH
VT_ERROR SCODE
VT_BOOL BOOL
VT_VARIANT VARIANT
VT_UNKNOWN LPUNKNOWN
pvRet:
//Address of the variable that will that will receive the property value or return value. It must match the type specified by vtRet.
pbParamInfo:一般都设置为NULL
//Pointer to a null-terminated string of bytes specifying the types of the parameters following pbParamInfo.
specifies the types of the parameters passed to the method or property.
...:
//Variable List of parameters, of types specified in pbParamInfo
谁能讲讲这个函数InvokeHelper
InvokeHelper函数的用法
一生只为等待能手绘这个函数给我的人
给你讲讲深圳这个改革暴发户到底是如何起家的
给你讲讲深圳这个改革暴发户到底是如何起家的
怎样设计个人主页?能讲讲具体操作步骤吗?谢谢了! 爱问知识人
谁能告诉我,这个老扬的真实身份?
讲讲冷笑话
讲讲volatile的作用
这个世界上只有你能欣赏我
强!馒头能做到这个程度!
能看懂看透这个笑话,你将前途无量
能看懂看透这个笑话,你将前途无量
能看懂看透这个笑话,你将前途无量
巧用Excel函数也能批量打印明信片
巧用Excel函数也能批量打印明信
在读者上看到《那一世》这首诗,好像在武林外传里也出现过的,能讲讲作者的事情吗?
讲讲咱老百姓的变化
婚姻调查:小三也讲讲道德
讲讲volatile的作用(转载)
[摄影贴图]四个女子搓麻将——谁能看懂这个油画《2008,北京》 - AAA级私秘视觉馆的...
这个枕头,能吓死很多人的【图】
在这个图里你能看到什么?
Java程序员这个职业赚钱吗?能赚多少钱?