Jump to content
  • Advertisement
Sign in to follow this  
Sharky

[MFC] Client area grab under Vista Aero

This topic is 3332 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all, I am currently working on an MFC (MDI) application and need to get a simple screengrab working (i.e. given a view, I need to grab the client area and save the contents to the clipboard and/or a file). This appeared quite simple and, yes, I have a basic version running whereby I grab the device context of the view I wish to grab, blit the contents to a bitmap, and then export to a file (or to the clipboard). This works fine on Win2k, WinXP and Vista (on both 32- and 64-bit platforms). However, if Vista is running the Aero (Glassy) UI then I end up with just a blank image (whether grabbing to the clipboard or a file). Does anybody know how to programmatically grab the client area of a view/window successfully when running Vista Aero? Any links, ideas or suggestions would be most welcome. Kind regards, Sharky

Share this post


Link to post
Share on other sites
Advertisement
A quick play with Google found: http://jmorrill.hjtcentral.com/Home/tabid/428/EntryId/278/Vista-DWM-Hacking-Capture-and-Stream-D3D-WPF-Windows-Real-Time.aspx

You could probably also just simulate an Alt-PrintScreen key press, and then get the result from the clipboard.

Share this post


Link to post
Share on other sites
Thanks for the reply, Adam_42. Whilst I could not use the code found at the link provided (for various reasons) it made for an interesting read and provided useful information.

Fortunately I have found a solution to the problem. The views (into which my MDI application renders) use DirectX and various render targets. Hence I simply grab the contents of the render target and save them to a file or, alternatively, grab the bits and convert into a bitmap format suitable for copying to the clipboard.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!