How can I save the current display to a file? (or screen capture?)
DirectX doesn't provide any default functions to save a screenshot. You can press the "PrintScreen" key after exiting from the application and open "MSpaint", and then select the "Paste" option. That will copy the clipboard into paint. However the problem is that, for each screenshot we have to run the application once. Here is a small solution that will copy the Images from Clipboard when we press a specific key and save it as a sequence starting from ScrnShot0.bmp. "CapScrn.h" uses the windows GDI to copy the current image in clipboard and save it as a 24-bit Bitmap. You can change the bitmap format if you wish :). Just include "CapScrn.h" to your Win32 project and call SaveScreenShot (m_HWnd, Width, Height) where m_HWnd is the handle to the window you wished to capture; Width & Height specifies how much of the clipboard image you wished to save.E.g. this will pick a FullScreenShot of your current Desktop
if (IsKeyDown (VK_F9)) SaveScreenShot (NULL/* this will pass the handle of current desktop window */, GetSystemMetrics (SM_CXSCREEN), GetSystemMetrics (SM_CYSCREEN));
FAQ Menu
Sponsored links
Build IT Knowledge with Current & Trusted Content
Helps Employees Develop & Hone New Technical Programming Skills. Sign Up & Get Full Access.
Helps Employees Develop & Hone New Technical Programming Skills. Sign Up & Get Full Access.
Check Out IT Certification Preparation Materials
Sign Up With SkillSoft & Get Access to Training Materials for Over 50 Professional Certifications.
Sign Up With SkillSoft & Get Access to Training Materials for Over 50 Professional Certifications.
Six Sigma Certification
100% Online-Six Sigma Certificate from Villanova - Find Out More Now.
100% Online-Six Sigma Certificate from Villanova - Find Out More Now.
SSH and SFTP support for .NET
Add complete SSH and SFTP support to your .NET framework application
Add complete SSH and SFTP support to your .NET framework application
3 Months Free - ASP.NET Web Hosting
3 Months Free & No Setup Fees on ASP.NET 3.5/2.0 Hosting on Windows 2008/2003 Servers ? Click Here!
3 Months Free & No Setup Fees on ASP.NET 3.5/2.0 Hosting on Windows 2008/2003 Servers ? Click Here!
