Click here to Skip to main content
15,884,177 members
Articles / Programming Languages / C#

How to capture a Window as an Image and save it

Rate me:
Please Sign up or sign in to vote.
4.43/5 (12 votes)
15 Jun 2007CPOL3 min read 142.8K   6.4K   91  
Take a snapshot of the main Window of any UI application
/*
 * Please leave this Copyright notice in your code if you use it
 * Written by Decebal Mihailescu [http://www.codeproject.com/script/articles/list_articles.asp?userid=634640]
 */
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following 
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("SnapShot")]
[assembly: AssemblyDescription("Takes a snapshot of the specified window application.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Decebal Mihailescu")]
[assembly: AssemblyProduct("SnapShot")]
[assembly: AssemblyCopyright("Copyright © Decebal Mihailescu 2007")]
[assembly: AssemblyTrademark("Decebal Mihailescu")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible 
// to COM components.  If you need to access a type in this assembly from 
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("c88189b0-09ea-44ce-b61c-ccc3113338d9")]

// Version information for an assembly consists of the following four values:
//
//      Major Version
//      Minor Version 
//      Build Number
//      Revision
//
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
United States United States
Decebal Mihailescu is a software engineer with interest in .Net, C# and C++.

Comments and Discussions