I'm trying to save a programatically created 256 grayscale bitmap into a general .bmp file.
I can show the bitmap on screen with this command:
StretchDIBits(hdc, 10, 10, 8, 9, 0, 0,
8, 9, buffer, &bmp_info, DIB_RGB_COLORS, SRCCOPY);
Now I need to get the bitmap into HBITMAP so that I could save it in a .bmp file. How do I do this? I basically know how to save the bitmap to disk after there is something on HBITMAP (i hope)
Tried to use this:
hBitmap = CreateCompatibleBitmap(hdc, 8, 9);
but I guess this doesn't contain the actual data on HDC since the bitmap file ended to be totally black.