On 5 Feb 2004 08:19:05 -0800,
(2xzero) wrote:
>Hello everyone,
>
>I've searched sun.java's website and haven't found any info on if this
>can be done. Perhaps someone here has done the same type of project.
Windows' event queue is not Java related, so no wonder you didn't find
anything there.
>Basically I want to listen for a popup message from this other
>application which I don't have the source code to and automate a 'yes'
>button press to it.
>
>So far the solution seems to need to use jni and then C++ dll to poll
>the windows event que, do a time diff,etc.....(yuk)
That's the most flexible and obvious aproach.
On the other hand, instead of polling the mesage queue, I would
suggest traversing the window list (using win32 EnumWindows API) at
regular intervals until your popup is found or you decide to timeout.
>However, I see
>that C# can do this very easily, perhaps I could integrate C# with
>java and be less work than the jni method.
I don't know how you would code this in C#, but doing it in c++ is
pretty trivial. And then, with JNI you have a nice, clean and standard
interface from Java to c++, an extra problem by itself you had to
solve if you were to code it in C#.
>
>I'm cluching straw here...can anyone share there experience with other
> possible solutions to this type of problem.
Check out Java/COM bridge solutions, which allow you to access COM
objects from Java. Neva Object's Java2Com works great. Or you could
have your native popup-catcher be a standalone app in whatever
language, start it with Runtime.exec() and let your Java app get rid
of that nasty stuff alltogether.
Last of all, since you seem willing to stick with such platfrom
dependant hassles, you could try out MS's VM (i.e., VisualJ++). It has
custom native interfaces that might suit you, and is pretty OO (that
means, Obscene and Obsolete).

>
>Much thanks in advance. Joe
regards
znôrt