Suggestions for Zorder Management
-
Hi All, I would like to create a module that manages ZOrders of windows in a system so that a particular group of windows (as identified by their Captions or Window Classes) are always together in zorder. This means no external apps (like notepad or Task Manager) should "interfere" with them. So far the approaches i`ve tried are : 1. Using Windows CBT Hooks to get Activation notifications for all windows in the system. Then based on which windows is being activated i do zorder management 2. Use the SetWinEvent Hook API , so whenever Foreground window changes i do my zorder management. But this is done "after" the foreground change has occured so to bypass it i use AttachThreadInput on the current foreground window, set my app window as the new Foreground window and then detach. Issue is ZOrder cant be maintained reliably and this sometimes causes my apps to hang. 3. Make all my app windows as Owned Windows of a single Owner window, but with this the internal ZOrder gets messed up if i show/hide my app windows. Is there any extra step i should take internally in my app windows, or issue some Messages form my Owner window before showing/activating any apps ? 4. A general question was : If I give SetWindowPos with the handle of a hidden window, or specify it as the hWndAfter parameter , what effect will this have on the ZOrder ? All my windows are TopLevel, Non-TopMost windows and they can create their own custom MessageBox and Dialogs (TopMost , Non-Topmost). So whatever mechanism i go with should be extensible to these message boxes too. Are there any other ways to this task ? Something better or faster ? I`ll be happy to provide more details if required. Any help and suggestions are most welcome. Thanks in advance.