oh, i didn't know CreateBitmap... but still, something's wrong... it seems to be creating the bitmap, but still i can't see it on the window. here's my code:
std::ifstream is;
is.open ("Image.bmp", std::ios::binary );
is.seekg (0, std::ios::end);
length = is.tellg();
is.seekg (0, std::ios::beg);
pBuffer = new char [length];
is.read (pBuffer,length);
is.close();
tagBITMAPFILEHEADER bfh = *(tagBITMAPFILEHEADER*)pBuffer;
tagBITMAPINFOHEADER bih = *(tagBITMAPINFOHEADER*)(pBuffer+sizeof(tagBITMAPFILEHEADER));
char* pPixels = (pBuffer+bfh.bfOffBits);
hBitmap = CreateBitmap(bih.biWidth, bih.biHeight, bih.biPlanes, bih.biBitCount, pPixels);
GetObject(hBitmap, sizeof(BITMAP), &cBitmap);
and on WM_PAINT:
hdc = BeginPaint(hWnd, &ps);
if(hBitmap != 0)
{
HDC hdcMem = CreateCompatibleDC(hDC);
SelectObject(hdcMem, hBitmap);
BitBlt(hDC, 10, 10, cBitmap.bmWidth, cBitmap.bmHeight, hdcMem, 0, 0, SRCCOPY);
DeleteDC(hdcMem);
}
EndPaint(hWnd, &ps);
What can I be doing wrong?