Call this function within your control's DoPropExchange member function to serialize or initialize a property represented by an object having an IUnknown-derived interface.

BOOL PX_IUnknown( 
   CPropExchange* pPX, 
   LPCTSTR pszPropName, 
   LPUNKNOWN& pUnk, 
   REFIID iid, 
   LPUNKNOWN pUnkDefault = NULL  


  • pPX
    Pointer to the CPropExchange object (typically passed as a parameter to DoPropExchange).

  • pszPropName
    The name of the property being exchanged.

  • pUnk
    Reference to a variable containing the interface of the object that represents the value of the property.

  • iid
    An interface ID indicating which interface of the property object is used by the control.

  • pUnkDefault
    Default value for the property.

Return Value

Nonzero if the exchange was successful; 0 if unsuccessful.


The property's value is read from or written to the variable referenced by pUnk, as appropriate. If pUnkDefault is specified, it will be used as the property's default value. This value is used if, for any reason, the control's serialization process fails.


Header: afxctl.h

See Also


MFC Macros and Globals