Dela via


DISP_PROPERTY_PARAM

Defines a property accessed with separate Get and Set member functions.

DISP_PROPERTY_PARAM(theClass, pszExternalName, pfnGet, pfnSet, vtPropType, vtsParams )

Parameters

  • theClass
    Name of the class.

  • pszExternalName
    External name of the property.

  • pfnGet
    Name of the member function used to get the property.

  • pfnSet
    Name of the member function used to set the property.

  • vtPropType
    A value specifying the property's type.

  • vtsParams
    A string of space-separated VTS_ variant parameter types, one for each parameter.

Remarks

Unlike the DISP_PROPERTY_EX macro, this macro allows you to specify a parameter list for the property. This is useful for implementing properties that are indexed or parameterized.

Example

Consider the following declaration of get and set member functions that allow the user to request a specific row and column when accessing the property:

SHORT GetArray(SHORT row, SHORT column);
void SetArray(SHORT row, SHORT column, SHORT newVal);

These correspond to the following DISP_PROPERTY_PARAM macro in the control dispatch map:

DISP_PROPERTY_PARAM(CMFCActiveXControlCtrl, "Array", GetArray, SetArray, VT_I2, VTS_I2 VTS_I2 )

As another example, consider the following get and set member functions:

IDispatch* GetItem(SHORT index1, SHORT index2, SHORT index3);
void SetItem(SHORT index1, SHORT index2, SHORT index3, IDispatch* pVal);

These correspond to the following DISP_PROPERTY_PARAM macro in the control dispatch map:

DISP_PROPERTY_PARAM(CMFCActiveXControlCtrl, "Item", GetItem, SetItem, VT_DISPATCH, VTS_I2 VTS_I2 VTS_I2)

Requirements

Header: afxdisp.h

See Also

Concepts

MFC Macros and Globals

Reference

DISP_PROPERTY_EX

Other Resources

Dispatch Maps