Export (0) Print
Expand All
MFC
TRY
Expand Minimize
0 out of 1 rated this helpful - Rate this topic

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.

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.

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:

afx_msg short GetArray( short row, short column );
afx_msg short SetArray( short row, short column, short nNewValue );

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

DISP_PROPERTY_PARAM( CMyCtrl, "Array", GetArray, SetArray, VT-I2, VTS_I2 VTS_I2 )

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

LPDISPATCH CMyObject::GetItem( short index1, short index2, short index3 );
void CMyObject::SetItem( short index1, short index2, short index3, LPDISPATCH newValue );

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

DISP_PROPERTY_PARAM( CMyObject, "item", GetItem, SetItem, VT_DISPATCH, 
   VTS_I2 VTS_I2 VTS_I2 )

Header: afxdisp.h

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.