I want to write a Windows 7 Window Manager in Java, but there are some issues. Fi开发者_如何学运维rst 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#?
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...
精彩评论