tags:

views:

28

answers:

1

I want to write a Windows 7 Window Manager in Java, but there are some issues. First of all, how do i manipulate the size and position of a window that doesn't belong to my own application? In other words, how can I manipulate the windows of other applications?

And, related to my first question, is it possible to get a list of all current windows?

And, the last question: is Java suited for this task or should I take a look at C#?

+1  A: 

First: Java is probably not the best suited language for this task. You need to call the native Windows API, so C/C++ would be a natural fit. You can use Java with JNI, but is probably not worth the hassle. I dont know about C#/Managed C++, so cant say something about it.

Getting a List of current Windows: http://support.microsoft.com/kb/183009

Changing Window Positions:
SetWindowPos
SetWindowPlacement

You may also need to get informed whenever a window changes. Look at e.g. SetWindowsHookEx, especially the CBTHook.

Edit: Last Time i tried, it was always allowed to change windows of other processes. If this isnt allowed anymore under windows7, you can always install a global hook and change the windows from INSIDE the process...

Markus Kull
I agree. If you're going to be interfacing with the underlying OS, C/C++ would be a better fit than Java.
Richard