createDIBsection failed
From: Francois (francois.aspert_at_epfl.ch)
Date: 08/17/04
- Next message: Alessio Calcagno: "INTERNAL COMPILER ERROR: compiler file 'msc1.cpp', line 1794"
- Previous message: Chan: "Compliation error in MSHTML.H"
- Next in thread: William DePalo [MVP VC++]: "Re: createDIBsection failed"
- Reply: William DePalo [MVP VC++]: "Re: createDIBsection failed"
- Reply: PinHead: "Re: createDIBsection failed"
- Reply: Igor Tandetnik: "Re: createDIBsection failed"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 17 Aug 2004 14:08:02 +0200
Hello!
i'm using the following code which is supposed to display a BMP image on
the screen.
But the result is a black rectangle.
CClientDC dc(this);
CDC bmDC;
bmDC.CreateCompatibleDC(&dc);
HDC hDC = bmDC.GetSafeHdc();
BITMAPINFO bmInfo;
bmInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bmInfo.bmiHeader.biWidth = im_data->width;
bmInfo.bmiHeader.biHeight = im_data->height;
bmInfo.bmiHeader.biPlanes = 1;
bmInfo.bmiHeader.biBitCount = 24;
bmInfo.bmiHeader.biCompression = BI_RGB;
bmInfo.bmiHeader.biSizeImage = 0;
bmInfo.bmiHeader.biXPelsPerMeter = 0;
bmInfo.bmiHeader.biYPelsPerMeter = 0;
bmInfo.bmiHeader.biClrUsed = 0;
bmInfo.bmiHeader.biClrImportant = 0;
bmInfo.bmiColors[0].rgbBlue = 0;
bmInfo.bmiColors[0].rgbGreen = 0;
bmInfo.bmiColors[0].rgbRed = 0;
bmInfo.bmiColors[0].rgbReserved = 0;
kdu_byte *inter = im_data->data_buf;
HBITMAP hBmp =
::CreateDIBSection(hDC,(BITMAPINFO*)&bmInfo,DIB_RGB_COLORS,(void**)&inter,NULL,NULL);
DWORD yoyo = GetLastError();
CBitmap bmp;
bmp.Attach(hBmp);
BITMAP bi;
bmp.GetBitmap(&bi);
CBitmap *pOldbmp = bmDC.SelectObject(&bmp);
dc.BitBlt(50,150,im_data->width,im_data->height,&bmDC,0,0,SRCCOPY);
bmDC.SelectObject(pOldbmp);
but the error code after CreateDIBsection returns me the error code : 8
i.e. not enough storage place.
what can be wrong there?
thanks
Francois
- Next message: Alessio Calcagno: "INTERNAL COMPILER ERROR: compiler file 'msc1.cpp', line 1794"
- Previous message: Chan: "Compliation error in MSHTML.H"
- Next in thread: William DePalo [MVP VC++]: "Re: createDIBsection failed"
- Reply: William DePalo [MVP VC++]: "Re: createDIBsection failed"
- Reply: PinHead: "Re: createDIBsection failed"
- Reply: Igor Tandetnik: "Re: createDIBsection failed"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|