DISP_FUNCTION

DISP_FUNCTION( theClass, pszName, pfnMember, vtRetVal, vtsParams )

#include <afxdisp.h>

Parameters

theClass

Name of the class.

pszName

External name of the function.

pfnMember

Name of the member function.

vtRetVal

A value specifying the function’s return type.

vtsParams

A space-separated list of one or more constants specifying the function’s parameter list.

Remarks

The DISP_FUNCTION macro is used in a dispatch map to define an OLE automation function.

The vtRetVal argument is of type VARTYPE. Possible values for this argument are taken from the VARENUM enumeration. They 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 vtsParams argument is a space-separated list of values from the VTS_ constants. One or more of these values separated by spaces (not commas) specifies the function’s parameter list. For example,

VTS_I2 VTS_PI2

specifies a list containing a short integer followed by a pointer to a short integer.

The VTS_ constants and their meanings are as follows:

Symbol Parameter Type
VTS_I2 short
VTS_I4 long
VTS_R4 float
VTS_R8 double
VTS_CY const CY or CY*
VTS_DATE DATE
VTS_BSTR LPCSTR
VTS_DISPATCH LPDISPATCH
VTS_SCODE SCODE
VTS_BOOL BOOL
VTS_VARIANT const VARIANT* or VARIANT&
VTS_UNKNOWN LPUNKNOWN
VTS_PI2 short*
VTS_PI4 long*
VTS_PR4 float*
VTS_PR8 double*
VTS_PCY CY*
VTS_PDATE DATE*
VTS_PBSTR BSTR*
VTS_PDISPATCH LPDISPATCH*
VTS_PSCODE SCODE*
VTS_PBOOL BOOL*
VTS_PVARIANT VARIANT*
VTS_PUNKNOWN LPUNKNOWN*

See Also   Dispatch Maps, DECLARE_DISPATCH_MAP, DISP_PROPERTY, DISP_PROPERTY_EX, BEGIN_DISPATCH_MAP, END_DISPATCH_MAP