myprasanna
2009-09-02 03:11:01 UTC
HDC hScreenDC = CreateDC ( TEXT("DISPLAY"), NULL, NULL, NULL );
VERIFY(hScreenDC); // Create a DC for screen
HDC hMemDC = CreateCompatibleDC(hScreenDC);
VERIFY(hMemDC); // Create a memory buffer DC
HBITMAP hMemBitmap = CreateCompatibleBitmap(hMemDC, rectDesktop.right,
rectDesktop.bottom); // Create a compatible bitmap.
VERIFY(hMemBitmap);
The above code causes hMemBitmap to be a monochrome bitmap !
replacing the last line by:
HBITMAP hMemBitmap = CreateCompatibleBitmap(hScreenDC, rectDesktop.right,
rectDesktop.bottom); // Create a compatible bitmap to screenDC
VERIFY(hMemBitmap);
Now this makes it a 32-bit BMP. Did you guys know this?
None of the msdn docs seem to mention anything of this sort. This is why I
hate the GDI. Large portions of it, are left to guessing. :(
VERIFY(hScreenDC); // Create a DC for screen
HDC hMemDC = CreateCompatibleDC(hScreenDC);
VERIFY(hMemDC); // Create a memory buffer DC
HBITMAP hMemBitmap = CreateCompatibleBitmap(hMemDC, rectDesktop.right,
rectDesktop.bottom); // Create a compatible bitmap.
VERIFY(hMemBitmap);
The above code causes hMemBitmap to be a monochrome bitmap !
replacing the last line by:
HBITMAP hMemBitmap = CreateCompatibleBitmap(hScreenDC, rectDesktop.right,
rectDesktop.bottom); // Create a compatible bitmap to screenDC
VERIFY(hMemBitmap);
Now this makes it a 32-bit BMP. Did you guys know this?
None of the msdn docs seem to mention anything of this sort. This is why I
hate the GDI. Large portions of it, are left to guessing. :(