| Author |
Capturing Screen
|
vineet kumar chaudhry
Ranch Hand
Joined: Apr 02, 2011
Posts: 45
|
|
Hi Java Lovers
I am using Robot class for capturing image which captures the screen as PrintScreen Command in our keyboard
The problem is :
It takes the screenshot of curent screen(all parts if some small sixe appl. are also open)
I am running my one of automated application in IE
The program will capture IE only if it is current window
I dont want this dependency .Is there any way to pass the parameters that this particular window should be captured
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
You specify the part of the screen to capture using the Rectangle. If you need to capture a specific window then you need to know the bounds of that window. Bad news - you're not going to do this with only Java. You'll need a bit of JNI for this.
Fortunately for you I've already written a non-Java program that uses the Windows API to do similar things, so I can tell you the native calls to use:
- EnumWindows to go through all the windows on your system
- GetWindowText to, for a window handle, get its caption (you could use this to filter on)
- GetWindowThreadProcessId to, for a window handle, get its process ID (you could use this to filter on)
- GetWindowRect to, for a window handle, get its bounds
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
vineet kumar chaudhry
Ranch Hand
Joined: Apr 02, 2011
Posts: 45
|
|
can you please send me the code....
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
|
We are NotACodeMill. Besides, it's C# and Delphi code, and you'd want to use C code for this.
|
 |
vineet kumar chaudhry
Ranch Hand
Joined: Apr 02, 2011
Posts: 45
|
|
|
I was talking about the non-java program which you have used !!!
|
 |
Darryl Burke
Bartender
Joined: May 03, 2008
Posts: 4165
|
|
|
So is Rob.
|
luck, db
There are no new questions, but there may be new answers.
|
 |
vineet kumar chaudhry
Ranch Hand
Joined: Apr 02, 2011
Posts: 45
|
|
Sorry Rob
I got you know
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
Here are the MSDN pages about these functions:
EnumWindows
GetWindowText
GetWindowThreadProcessId
GetWindowRect
|
 |
 |
|
|
subject: Capturing Screen
|
|
|