activex控件 InvokeHelper

当你调用关于activex控件中的相关方法时,你要导入此控件到程序中,此时就会在工程中生成一个关于此控件调用的一个伪调用类,其中的cpp中调用每 个方法都是通过InvokeHelper调用其中的dwDispID值来定位方法的地址的!因此,可以将InvokeHelper调用理解为定位 activex控件中的相关方法的一种手段

invokehelper:   用于调用OLE   的IDispatch   接口方法的一个封装方法。

CWnd::InvokeHelper

Call this member function to invoke the ActiveX Control method or property specified by dwDispID , in the context specified by wFlags .

void AFX_CDECL InvokeHelper(
DISPID dwDispID,
WORD wFlags,
VARTYPE vtRet,
void* pvRet,
const BYTE* pbParamInfo,
...
);
Parameters
dwDispID
Identifies the method or property to be invoked.
wFlags
Flags describing the context of the call to IDispatch::Invoke . For possible wFlags values, see IDispatch::Invoke in the Platform SDK .
vtRet
Specifies the type of the return value. For possible values, see the Remarks section for COleDispatchDriver::InvokeHelper .
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
Pointer to a null-terminated string of bytes specifying the types of the parameters following pbParamInfo . For possible values, see the Remarks section for COleDispatchDriver::InvokeHelper .
...
Variable List of parameters, of types specified in pbParamInfo .
Remarks

The pbParamInfo parameter specifies the types of the parameters passed to the method or property. The variable list of arguments is represented by ... in the syntax declaration.

This function converts the parameters to VARIANTARG values, then invokes the IDispatch::Invoke method on the ActiveX control. If the call to IDispatch::Invoke fails, this function will throw an exception. If the SCODE (status code) returned by IDispatch::Invoke is DISP_E_EXCEPTION , this function throws a COleException object, otherwise it throws a COleDispatchException .

Note    This function should be called only on a CWnd object that represents an ActiveX control.

For more information about using this member function with ActiveX Control Containers, see the article ActiveX Control Containers: Programming ActiveX Controls in an ActiveX Control Container.

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值