CDC cMemDC;
cMemDC.CreateCompatibleDC( NULL ); CBitmap bitmap;
bitmap.CreateCompatibleBitmap( &dc, rtScreen.Width( ), rtScreen.Height( ) ); CBitmap* pOldBitmap;
pOldBitmap = cMemDC.SelectObject( &bitmap ); cMemDC.BitBlt(
rtScreen.left, rtScreen.top,
rtScreen.Width( ), rtScreen.Height( ),
&dc,
0, 0,
SRCCOPY ); // 这里确定是有数据的。 DWORD dwSize = bitmap.GetBitmapBits( 0, NULL );
BYTE* pBuffer = new BYTE[ dwSize ];
bitmap.GetBitmapBits( dwSize, pBuffer );// 这里,pBuffer全都是0
cMemDC.CreateCompatibleDC( NULL ); CBitmap bitmap;
bitmap.CreateCompatibleBitmap( &dc, rtScreen.Width( ), rtScreen.Height( ) ); CBitmap* pOldBitmap;
pOldBitmap = cMemDC.SelectObject( &bitmap ); cMemDC.BitBlt(
rtScreen.left, rtScreen.top,
rtScreen.Width( ), rtScreen.Height( ),
&dc,
0, 0,
SRCCOPY ); // 这里确定是有数据的。 DWORD dwSize = bitmap.GetBitmapBits( 0, NULL );
BYTE* pBuffer = new BYTE[ dwSize ];
bitmap.GetBitmapBits( dwSize, pBuffer );// 这里,pBuffer全都是0
试试
HDC screen = CreateDC("DISPLAY", 0, 0, 0);
cMemDC.CreateCompatibleDC(screen);
rtScreen.left, rtScreen.top,
rtScreen.Width( ), rtScreen.Height( ),
&dc,
0, 0,
SRCCOPY ); // 这里确定是有数据的。
0, 0,
rtScreen.Width( ), rtScreen.Height( ),
&dc,
rtScreen.left, rtScreen.top,
SRCCOPY );