Hello,
for windows, maybe this example could help:
public interface MyUser32 extends com.sun.jna.examples.win32.Kernel32
{
// Method declarations, constant and structure definitions go here
/** The INSTANCE. */
MyUser32 INSTANCE = (MyUser32)
Native.loadLibrary("User32", MyUser32.class);
public interface WNDENUMPROC extends StdCallCallback
{
/** Return whether to continue enumeration. */
boolean callback(Pointer hWnd, int data);
}
boolean EnumWindows(WNDENUMPROC lpEnumFunc, int data);
}
// define callback to print pid of window
MyUser32.WNDENUMPROC callback= new MyUser32.WNDENUMPROC()
{
public boolean callback(Pointer wnd, int lParam)
{
// print the pid of the window
IntByReference dwID = new IntByReference();
MyUser32.INSTANCE.GetWindowThreadProcessId(wnd, dwID);
System.out.println(dwID.getValue());
}
// continue with next window
return true;
}
};
// show pid of all windows
MyUser32.INSTANCE.EnumWindows(callback, 0);
- Ron
http://yajsw.sourceforge.net/
Stefan Endrullis wrote:
Hi Guan,
Guan Eglesio schrieb:
Im writing a java app that needs some OS specific info (winxp);
- information about all the windows that are currently open
(firefox/itunes/notepas/etc)
for instance there: size/location/state etc.
If you would ask for the same under Linux, I could suggest you
the "x11" project in the "contrib" section. There you have all
you need to get easily to this information.
But it should be also possible under Windows. You just have to
write the JNA mappings for necessary C libraries.
BTW there's already a class in the examples section which allows
you to set window transparency and shape. Maybe this file
(especially the inner class W32WindowUtils) could be a good
starting point. The location of the file is:
trunk/jnalib/src/com/sun/jna/examples/WindowUtils.java