I'm working with BITMAPs/HBITMAP/LPBITMAP in a Windows C++ application.
I'm currently loading a bitmap file into an HBITMAP via:
LPBITMAP lpBitmap = new BITMAP();
HBITMAP hBitmap = (HBITMAP)LoadImage(NULL, "BitmapFileName", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE | LR_CREATEDIBECTION);
GetObject(hBitmap, sizeof(BITMAP), lpBitmap);
I need to get access to the underlying byte array for processing.
How do I get the byte array from the BITMAP? (without going to a temp file).
I know I can get access to the buffer by directly reading it from the file (via Bitmap header).
But, clients will be passing a BITMAP.
How do I achieve this?