Hi guys can someone show me a sample code. How can I make a screenshot of mfc dialog client area and save it as a .bmp file ? So far I just get weird results i.e. black or white screen but the shape and size are right, just can't see the content as I said. Please help. THank you.
I did hit problems trying to grab a "screen shot" of an individual window not so long ago; the bitmap was the right size but totally black.
What I was doing was acquiring the DC for the window (GetWindowDC) and the using the usual CreateCompatibleDC, CreateCompatibleBitmap, BitBlt approach to capture a bitmap. Which was all black.
But the same approach worked fine to grab the whole screen. So I ended up acquiring the DC for the whole screen -- using GetDC(NULL) -- and the just BitBlt-ing the area I was interested in into the bitmap (for me this was the whole window, including the border and menu, but could just as easily be the client area.)
Andy
PS I didn't investigate the problem any further, but my problem with the DC obtained with GetWindowDC might be something to do with the way the Desktop Windows Manager (DWM) does its compositing.