转:InvokeHelper函数的用法

转自:http://blog.sina.com.cn/s/blog_49364213010003co.html

      今天看代码时遇到了这个函数,在此把InvokeHelper函数的用法写下来,一来方便自己看,二来希望对大家也有帮助。
     
     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.

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值