Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Difficult : Control application B from application A 1

Status
Not open for further replies.

Themuppeteer

Programmer
Joined
Apr 4, 2001
Messages
449
Location
BE
Can one from inside a java application know when another java application is started ? and then get control over that application (and change its coordinates) ?

e.g. Application A is running. Application B is started.
then App A gives a message like 'new program started'
and moves it to different coordinates.

in C++ under linux it is possible, one just has to listen to the events and when a new window pops up, catch the event, get the winow ID and with that you have full control.
Now I woul like to know if it is possible on windows in java.

thnx a lot.

Greetz,
img


NOSPAM_themuppeteer@hotmail.com (for mails, remove the NOSPAM_)

"Those who say they understand chess, understand nothing"

-- Robert HUBNER
 
Catching events of new processes being launched is clearly a OS dependent activity and is therefore not part of Java. So yes you can do it but you would have to use JNI and of course write the native Windows code to support the functionality.

-pete
 
I think you can do some things with only java code in different ways :

1. Through socket communication.
2. By using 1 main java program from which you start all the others.
3. By using Javaspaces, Jini or other exotic stuff. (there is a seperate forum forum944 for this)
4. There is something like "shared memory" (I don't remember where I got that from).
...
 
Hologram’s points are correct with a clarification for #4. However IPC requires cooperation between the two applications which is not at all indicated in the original question. This is why I did not suggest any IPC mechanisms in my post. So now we will wait to see what Robert tells us about his requirements for his project. [lol]

Hologram, I was wondering what you meant by "like shared memory". What I mean is that nothing is "like" shared memory. You either have it or you don’t. Everything else is marshalling data.


-pete
 
Hello,

Thnx for your replys.
First my appologies but I did not explain myself to well..
First ,its for on a windows machine, and second I don't know wich applications are started. Its detection of 3th party applications that I should be able to detect. Writing a windows program that talks through sockets with the java client is the immergency solution. I first would like to know if there is any other way. Probably not sinceeach java program runs in his own virtual machine..





Greetz,
img


NOSPAM_themuppeteer@hotmail.com (for mails, remove the NOSPAM_)

"Those who say they understand chess, understand nothing"

-- Robert HUBNER
 
In other words you want to hijack a window from an application you did not start yourself and do something with it?

Sounds fishy.
 
Since the other programs are not java and not your own, like palbano said use "jni" or a "java-to-com-bridge". There are already a few threads about this in this forum.
 
Oki,

yes jwenting fishy is my second name ;)
Thnx for your replys, you gave me certainty about what I already suspected..

Greetz,
img


NOSPAM_themuppeteer@hotmail.com (for mails, remove the NOSPAM_)

"Those who say they understand chess, understand nothing"

-- Robert HUBNER
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top