I am trying to display a 24bit True Colour image, using a block of uncompressed BGR data.


BITMAPINFO bitInfo;
BITMAPINFOHEADER biH;
HDC hdc, hdcdest;
HBITMAP hbm, oldhbm;
unsigned char *hPicPtr; // Holds bitmap data serially in 3 byte groups of Blue Green Red
.
.
hdc = CreateCompatibleDC( hdcdest );
hbm = CreateDIBitmap( hdc, &biH, CBM_INIT, hPicPtr, &bitInfo, DIB_RGB_COLORS );
check=GetLastError();
oldhbm = SelectObject(hdc, hbm);
.




The HBITMAP handle hbm is NULL after the CreateDIBitmap function has run, and GetLastError() returns 87 which is ROR_INVALID_PARAMETER. Have you any suggestions why the CreateDIBitmap function returns NULL ?