Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / March 2006

Tip: Looking for answers? Try searching our database.

Getting the size of another program window?

Thread view: 
Tirpen - 12 Mar 2006 19:42 GMT
Is there an easy way to get the position and dimension of the window
of another program that is running?

My problem is that I want to do a screen capture of the part of the
screen that corresponds to parts of the window of another program every
5 seconds and save them. (It sounds silly, but I have my reasons). I
know how to do the actual screenshot and save it, but I have no Idea
how to find the position of the window.
I know the name of the process and this only has to work on Windows
(but it would off course be nice if it worked elsewhere also), any
ideas?
Chris Smith - 12 Mar 2006 22:45 GMT
>  Is there an easy way to get the position and dimension of the window
> of another program that is running?

You can do this with the Win32 API, but not with Java.  You will need to
use JNI to call into native Windows code.

Signature

www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation

Tirpen - 13 Mar 2006 13:34 GMT
Ok, thanks a lot for the reply, I'll read up on the Win32 API then.
opalpa@gmail.com opalinski from opalpaweb - 13 Mar 2006 00:02 GMT
You can make a windows executable that when invoked on command line
prints out coordinates and dimensions.  You can invoke this executable
from within Java and capture its output.

If you want to package the code into a jar then put the exe into jar,
read it into Java and write it out to temporary directory.  Then use it
from temporary directory.

I've got C# code for the windows executable and Java code to bring
executable out of jar and to run it.  Will sell it for 35 USD via
paypal.

Opalinski
opalpa@gmail.com
http://www.geocities.com/opalpaweb/
Chris Smith - 13 Mar 2006 00:14 GMT
> I've got C# code for the windows executable and Java code to bring
> executable out of jar and to run it.  Will sell it for 35 USD via
> paypal.

Does anyone actually think this is an appropriate use of newsgroups?

I'm tempted to assume not, and just dismiss this person as a ******
(insert favorite expletive), but then I'm not quite sure.  I tend to be
biased more than normal against the damnable trend toward people
assuming that all public spaces exist for their free advertising.

Signature

www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation

Roedy Green - 13 Mar 2006 00:21 GMT
>I'm tempted to assume not, and just dismiss this person as a ******
>(insert favorite expletive), but then I'm not quite sure.  I tend to be
>biased more than normal against the damnable trend toward people
>assuming that all public spaces exist for their free advertising.

It is not advertising if someone asks for a solution and you hand them
one that is not free.  It is advertising when you tell people about
your product who have expressed no prior interest it in.

You could even say talking about some FREE program you wrote was
advertising.  I find it odd in a country that has capitalism as the
state religion there is such squeamishness about mentioning products
that cost money.

I also find it highly peculiar that the most common restriction on
software in that it may not be used for commercial purposes.  Isn't
that communist?

Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

Rhino - 13 Mar 2006 00:55 GMT
>>I'm tempted to assume not, and just dismiss this person as a ******
>>(insert favorite expletive), but then I'm not quite sure.  I tend to be
[quoted text clipped - 13 lines]
> software in that it may not be used for commercial purposes.  Isn't
> that communist?

No it isn't. I'm pretty sure the intent of that restriction is to get you to
use the free version of the program if you are not making any money by using
it and to pay for a shrinkwrap version or licence if you are making money;
in the latter case, the developer gets a cut of whatever you making by using
his program. That seems pretty fair to me and not communistic at all.

--
Rhino
Oliver Wong - 15 Mar 2006 18:44 GMT
>> I've got C# code for the windows executable and Java code to bring
>> executable out of jar and to run it.  Will sell it for 35 USD via
[quoted text clipped - 6 lines]
> biased more than normal against the damnable trend toward people
> assuming that all public spaces exist for their free advertising.

   I'm okay with it, but then again, I'm okay with a lot of things, so
possibly I'm biased in the opposite direction. I've opalinski make helpful
(advertisement-free) posts before, so it's not like (s)he is posting spam to
newsgroups which (s)he doesn't even bother to read or contribute to.

   The OP posted some problem, and I guess Opalinski had previously solved
this problem and considered it to be non-trivial. Perhaps it was non-trivial
enough that Opalinski felt it would take too much effort to actually fully
explain the solution. So from there, Opalinski had two options: just keep
quiet, or let the OP know that (s)he can buy a solution.

   I argue that the latter, giving the OP the option to buy the solution,
is "more helpful", than the former, not giving the OP that option at all.

   - Oliver

P.S. as an aside, and this isn't a comment on the OP at all, but I find it
amusing how often I see threads of the form:

A: URGENT!!! I need someone to solve this problem for me RIGHT AWAY! MISSION
CRITICAL!!!
B: I'll do it for 5 bucks.
A: No, I'm willing to wait for someone to do it for me for free.
Andrey Kuznetsov - 15 Mar 2006 23:16 GMT
> P.S. as an aside, and this isn't a comment on the OP at all, but I find it
> amusing how often I see threads of the form:
[quoted text clipped - 3 lines]
> B: I'll do it for 5 bucks.
> A: No, I'm willing to wait for someone to do it for me for free.

the conclusion thereof is that 5 bucks are even more mission critical ;-)

Andrey

Signature

http://uio.imagero.com Unified I/O for Java
http://reader.imagero.com Java image reader
http://jgui.imagero.com Java GUI components and utilities

Chris Smith - 16 Mar 2006 05:23 GMT
>     I'm okay with it, but then again, I'm okay with a lot of things, so
> possibly I'm biased in the opposite direction.

Nah.  Must just be me, then.  Thanks.

Signature

www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.