|
-
January 2nd, 2007, 08:39 AM
#1
find other application's window
Hi there!
It's been a long time since my last visit, but now I'm back with a brand new question:
From a Java application (JFrame implementing a main method) I would like to set the focus to a certain application which is also running on the Windows machine. When this application has the focus, I will send a "F5"-keypress to it (using the Robot class) to make it perform a data refresh.
It would be perfect, if I could - for example - find the applications window by it's title and then maximize it. Is there a way to do that?
Thanx in advance, any help will be appreciated.
Regards,
leo
-
January 3rd, 2007, 05:59 PM
#2
Re: find other application's window
You can't do that directly in Java, other applications are managed by the operating system. You could use the JNI (Java Native Interface) to tell the Windows OS what to do, but you'd need to write a native DLL (using .NET or C++, etc) to interface between Java and Windows, which is a fair amount of work, so you might as well write the whole thing in native Windows code.
Java isn't really the language of choice for OS related activities because it is OS independent.
Any programming problem can be solved by adding a level of indirection...
Anon.
Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.
-
January 4th, 2007, 02:53 AM
#3
Re: find other application's window
 Originally Posted by dlorde
Java isn't really the language of choice for OS related activities because it is OS independent.
i see. thanx for the reply.
i know that java isn't very well suited for OS-stuff. anyway, the application i'm working on isn't either! the problem described above is the one and only thing in the application which is that low-level, so i was looking for a simple solution (i had already thought about writing native code, but at first sight, that seemed not to be worth the effort).
i'd really be glad if someone had such a simple solution!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|