COleDispatchDriver::InvokeHelper

Calls the object 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 a list of possible values, see the wFlags parameter in IDispatch::Invoke Method in the Windows SDK.

  • vtRet
    Specifies the type of the return value. For possible values, see the Remarks section.

  • pvRet
    Address of the variable 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.

  • ...
    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.

Possible values for the vtRet argument are taken from the VARENUM enumeration. Possible values are as follows:

Symbol

Return Type

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

The pbParamInfo argument is a space-separated list of VTS_ constants. One or more of these values, separated by spaces (not commas), specifies the function's parameter list. Possible values are listed with the EVENT_CUSTOM macro.

This function converts the parameters to VARIANTARG values, then invokes the IDispatch::Invoke Method method. If the call to 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.

For more information, see VARIANTARG, Implementing the IDispatch Interface [Automation], IDispatch::Invoke Method, and Structure of COM Error Codes in the Windows SDK.

Example

See the example for COleDispatchDriver::CreateDispatch.

Requirements

Header: afxdisp.h

See Also

Reference

COleDispatchDriver Class

Hierarchy Chart

COleException Class

COleDispatchException Class