Call this function within your control's DoPropExchange member function to serialize or initialize a property of type font.

BOOL PX_Font( 
   CPropExchange* pPX, 
   LPCTSTR pszPropName, 
   CFontHolder& font, 
   const FONTDESC FAR* pFontDesc = NULL, 
   LPFONTDISP pFontDispAmbient = NULL  


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


The name of the property being exchanged.


A reference to a CFontHolder object that contains the font property.


A pointer to a FONTDESC structure containing the values to use in initializing the default state of the font property, in the case where pFontDispAmbient is NULL.


A pointer to the IFontDisp interface of a font to use in initializing the default state of the font property.

Nonzero if the exchange was successful; 0 if unsuccessful.

The property's value is read from or written to font, a CFontHolder reference, when appropriate. If pFontDesc and pFontDispAmbient are specified, they are used for initializing the property's default value, when needed. These values are used if, for any reason, the control's serialization process fails. Typically, you pass NULL for pFontDesc and the ambient value returned by COleControl::AmbientFont for pFontDispAmbient. Note that the font object returned by COleControl::AmbientFont must be released by a call to the IFontDisp::Release member function.

Header: afxctl.h

Community Additions