activex控制項 InvokeHelper

來源:互聯網
上載者:User

當你調用關於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.

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.