Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1071
  • Last Modified:

Obtaining screenshot of specific window (Like ALT+PRINTSCREEN)

How can I grab a screenshot of a specific window?  (Similar to doing an ALT+PRINSCREEN)

I not only need to know how to get the specific window's screenshot, but also how to get whatever parameter I would need to pass to indicate the specific window I wanted.  I can identify the window I need by it's title, so I assume there has to be a way to do it from that.

I don't mind doing this in C++ or C#.  Using .Net is fine, using the Win32 API is fine.  Whatever it takes to get the job done.
0
darlingm2
Asked:
darlingm2
2 Solutions
 
JohnGabyCommented:
What form to you want the screenshot in (e.g. HBITMAP, .jpg file, etc)?
0
 
WerrockCommented:
Someone did something like this and posted it here:
http://www.xtremevbtalk.com/showthread.php?t=169757
0
 
numberkruncherCommented:
This can be done using the PrintWindow Win32 API call. The example demonstrated at the following link utilizes C++ with the MFC framework, but this could easily be converted into a non-MFC equivalent.

http://weseetips.com/2008/07/14/how-to-capture-the-screenshot-of-window/

Likewise, if you preferred, you could use C# instead by importing the required Win32 methods. If you haven't done this before, here is a useful link which describes how to use P/Invoke:
http://msdn.microsoft.com/en-us/magazine/cc164123.aspx
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now