I would like to find the window id of my SWT program.
I run my SWT shell in the standard way. How can I find the id of the created window? The program runs on Fedora 10 using the Compiz-Fusion window manager (if that matters).
Code to help explain what I mean:
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell();
shell.open();
while (!shell.isDisposed()) {
if(!display.readAndDispatch()) {
display.sleep();
}
}
}
Update March 6, 2009
After reviewing and trying out a number of things (thanks to VonC for the suggestions below), I came across what has worked so far. This is extremely trickery, but at least it allows me to continue working on some other job.
The identifier returned from Control.embeddedHandle is close to the identifier of the window. It has a predicted bias. So my code is:
public static void main(String[] args) {
...
Shell shell = new shell(display, SWT.NONE);
Composite e = new Composite(shell, SWT.EMBEDDED);
long windowID = e.embeddedHandle - WINDOW_ID_MAGIC_NUMBER;
e.dispose();
....
WINDOW_ID_MAGIC_NUMBER - 5+ ( , ).
, . , .