Not without quite some native code. All it has access to are all window objects created by the current application.
You will need the "EnumWindows" call in C or Visual Basic to enumerate over all windows. Inside the enumerating function you can use "IsWindowVisible", "GetWindowText" and "GetWindowRect" to query the visibility, caption and bounds of the windows.
A bit of template code you may be able to use:
You call this as follows:
with xxx being a pointer to some structure you want to pass along to the GetWindowInformation function.
Here's also the code to create a java.awt.Rectangle from a RECT object (ignoring any possible error codes):
First of all a warning: the code I posted is native C code, and works with Windows only. Mac and Linux have different ways which unfortunately I don't know, and is also determined to the windowing system used. X11 and Xorg may have different calls for this.
Matteo Lanzi wrote:so you mean in java i can use an int pointer to a window? [/url]
HWND is the same size as an int, so yes you can. Just remember to cast it back to HWND in native code.
However, I don't know the size of window handles in Mac or Linux, so you may have to end up with long instead and discard part of it when converting to HWND.
in java with (*env) i can dereference a pointer?
There are no pointers in Java. As I said at the top of this post, the code I posted is C code. With (*env) you can dereference a pointer in C, but not in Java.
of course i have to make dll for win mac and linux, so can embed them in the project and still use an applet? I'd like to use an applet because this application have to works with a flex application
If you use the same class(es) for Windows, Mac and Linux with just different native implementations, there is no problem. Just call System.loadLibrary and it will translate the library for you to a native file. For instance, searches for mywindows.dll in Windows, and for libmywindows.so in Linux (and probably Mac as well).