Sign in to follow this  
Sharky

[MFC] Client area grab under Vista Aero

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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this