BOOL CBLOBSDlg::ReadFromBLOB(CByteArray & DBArray)
{
CByteArray Array;
Array.Copy( DBArray);
// the header of BLOB is OLE stuff like "Paint Brush Application" .... ecc..
// the len is 78 byte ( I do not know for other headers )
int HeaderLen = 78 + sizeof(BITMAPFILEHEADER);
Array.RemoveAt( 0, HeaderLen ); // I cut all Headers
// some BMP information
BITMAPINFOHEADER &bmiHeader = *(LPBITMAPINFOHEADER)Array.GetData() ;
BITMAPINFO &bmInfo = *(LPBITMAPINFO)Array.GetData() ;
// If bmiHeader.biClrUsed is zero we have to infer the number
// of colors from the number of bits used to specify it.
int nColors = bmiHeader.biClrUsed ? bmiHeader.biClrUsed : 1 << bmiHeader.biBitCount;
HBITMAP hBmp = CreateDIBitmap( dc.m_hDC, // handle to device context
&bmiHeader, // pointer to bitmap size and format data
CBM_INIT, // initialization flag
lpDIBBits, // pointer to initialization data
&bmInfo, // pointer to bitmap color-format data
DIB_RGB_COLORS); // color-data usage