I did not check the complete code. But a cite from the MSDN GetDIBits() function shows one problem:
Quote:
The bitmap identified by the hbmp parameter must not be selected into a device context when the application calls this function.
To locate such errors, it is helpful to check the return values of all functions that may indicate error conditions by return value. To limit the check to debug builds, use the
ASSERT()
and
VERIFY()
macros; e.g. for the
GetDIBits()
function:
VERIFY(cBitmap.height == SetDIBits(RemoteDC, hbitmap, 0, cBitmap.bmHeight, chIncomingDataBuffer+iEnd+bisize, &bi, DIB_RGB_COLORS));