Hello everyone,
I have been trying to display an image from an array . I tried with
CreateDIBSection() and SetDIBitsToDevice() but the resulting image is
black. I would like to know what's missing/wrong in the code. Any help
would be appreciated......and thanks in advance.



// x is the array
void FirstBitmap::showBitmap(HDC hdc)
{
DIBINFO dibInfo;
dibInfo.bmiHeader.biBitCount = 24;
dibInfo.bmiHeader.biClrImportant = 0;
dibInfo.bmiHeader.biClrUsed = 0;
dibInfo.bmiHeader.biCompression = BI_RGB;
dibInfo.bmiHeader.biHeight = pBitmap->bmHeight;
dibInfo.bmiHeader.biPlanes = 1;
dibInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
dibInfo.bmiHeader.biSizeImage = pBitmap->bmWidth*pBitmap->bmHeight;
dibInfo.bmiHeader.biWidth = pBitmap->bmWidth;
dibInfo.bmiHeader.biXPelsPerMeter = 3780;
dibInfo.bmiHeader.biYPelsPerMeter = 3780;
dibInfo.bmiColors[0].rgbBlue = 0;
dibInfo.bmiColors[0].rgbGreen = 0;
dibInfo.bmiColors[0].rgbRed = 0;
dibInfo.bmiColors[0].rgbReserved = 0;


CDC pDC;
CBitmap bitmap;
CDC SpeicherDC;
width =3000;
height = 3000;
CBitmap* pAltesBitmap;

HBITMAP hTargetBitmap;
void *pBuffer [6700];

pDC.SetOutputDC(hdc);

hTargetBitmap = CreateDIBSection(hdc,(const BITMAPINFO*)
dibInfo,DIB_RGB_COLORS, (void**)&pBuffer,NULL,0); // x is the array

SpeicherDC.CreateCompatibleDC(&pDC);

SetDIBitsToDevice(hdc,0,0,width,height,0, 0 ,0,height,x,dibInfo,
DIB_RGB_COLORS);

(HBITMAP)::SelectObject(SpeicherDC.GetSafeHdc(), hTargetBitmap);

pDC.BitBlt( 300, 100, 3000, 3000,&SpeicherDC, 0, 0, SRCCOPY) ;

}