I can get a BITMAP struct from a HBITMAP handle using GetObject( ... )
HBITMAP hSrc = // source image
BITMAP bDst;
GetObject(hSrc, sizeof(BITMAP), &bDst);
...
But was wondering if there was a way of calculating the memory usage, (or footprint?) of that image.
I don't want to display images that are more than xyz in size of memory.
typedef struct tagBITMAP
{
LONG bmType;
LONG bmWidth;
LONG bmHeight;
LONG bmWidthBytes;
WORD bmPlanes;
WORD bmBitsPixel;
LPVOID bmBits;
} BITMAP, *PBITMAP, NEAR *NPBITMAP, FAR *LPBITMAP;
LPVOID bmBits; contains all the data, but how can I calculate the size of that void*
pointer?
bmWidth*bmHeight*bmBitsPixel
? But then where doesbmPlanes
andbmWidthBytes
fit in or are they not involved in the actual size? – Simon Goodman