I have a Windows box that is running three applications. When the applications are started each application creates a borderless window which is positioned such that they overlap in a particular way.
At the moment, when I click on a control on the bottom window, it comes to the top of the window stack.
I need to ensure that each window keeps its order in the window stack even if a window receives input.
I am thinking I need to write some sort of simple window manager that will maintain the correct Z-order of the windows.
The problem is, I need to know if a particular window has changed position. I have found that there is a WM_WINDOWPOSCHANGING message but my understanding is that this message is send to the window whose position has changed.
I need my window manager application to be somehow notified that the Z-order has changed.
Is there some way I can catch all WM_ messages and determine if the message applies to one of the windows I wish to control?
Instead of MSalter's approach trying to DLL injection into each of the running the application, consider installing a WH_CBT Windows hook. In your CBTProc, return 0 when you get a HCBT_MOVESIZE for the three application window handles you care about.
Read MSDN for the docs on CBTProc and SetWindowsHookEx.