Screen capture of MDI app with OpenGL graphics using MFC

Posted by NPVN on Stack Overflow See other posts from Stack Overflow or by NPVN
Published on 2010-04-23T11:20:47Z Indexed on 2010/04/23 11:23 UTC
Read the original article Hit count: 294

Filed under:
|
|
|

In our MDI application - which is written in MFC - we have a function to save a screenshot of the MDI client area to file. We are currently doing a BitBlt from the screen into a bitmap, which is then saved. The problem is that some of the MDI child windows have their content rendered by OpenGL, and in the destination bitmap these areas show up as blank or garbled.

I have considered some alternatives:
- Extract the OpenGL content directly (using glReadPixels), and draw this to the relevant portions of the screen bitmap.
- Simulate an ALT+PrtScr, since doing this manually seems to get the content just fine. This will trash the clipboard content, though.
- Try working with the DWM. Appart from Vista and Win7, this also needs to work on Win2000 and XP, so this probably isn't the way to go.

Any input will be appreciated!

© Stack Overflow or respective owner

Related posts about mfc

Related posts about mdi