Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize


Call this function within your control's DoPropExchange member function to serialize or initialize a property that stores binary large object (BLOB) data.

BOOL PX_Blob( 
   CPropExchange* pPX, 
   LPCTSTR pszPropName, 
   HGLOBAL& hBlob, 
   HGLOBAL hBlobDefault = NULL  


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


The name of the property being exchanged.


Reference to the variable where the property is stored (typically a member variable of your class).


Default value for the property.

Nonzero if the exchange was successful; 0 if unsuccessful.

The property's value will be read from or written to the variable referenced by hBlob, as appropriate. This variable should be initialized to NULL before initially calling PX_Blob for the first time (typically, this can be done in the control's constructor). If hBlobDefault is specified, it will be used as the property's default value. This value is used if, for any reason, the control's initialization or serialization process fails.

The handles hBlob and hBlobDefault refer to a block of memory which contains the following:

  • A DWORD which contains the length, in bytes, of the binary data that follows, followed immediately by

  • A block of memory containing the actual binary data.

Note that PX_Blob will allocate memory, using the Windows GlobalAlloc API, when loading BLOB-type properties. You are responsible for freeing this memory. Therefore, the destructor of your control should call GlobalFree on any BLOB-type property handles to free up any memory allocated to your control.

Header: afxctl.h

Community Additions

© 2015 Microsoft