?
Solved

Obtaining screenshot of specific window (Like ALT+PRINTSCREEN)

Posted on 2008-10-25
3
Medium Priority
?
1,054 Views
Last Modified: 2012-06-27
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
Comment
Question by:darlingm2
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 9

Expert Comment

by:JohnGaby
ID: 22804280
What form to you want the screenshot in (e.g. HBITMAP, .jpg file, etc)?
0
 
LVL 6

Accepted Solution

by:
Werrock earned 1000 total points
ID: 22804299
Someone did something like this and posted it here:
http://www.xtremevbtalk.com/showthread.php?t=169757
0
 
LVL 13

Assisted Solution

by:numberkruncher
numberkruncher earned 1000 total points
ID: 22804447
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question