I do now there is a DLL for this.
It can arrange all programs and windows opened.

You can find it at mircscripts.org

I don't know how it works, but there is a good documantation inside the zip file...

Good luck