
How to Keep an MDI Window Always on Top
Quote:
> Hi,
> I have been looking around for a long time to find a solution that could
> keep a MDI-child windows on the top!
> The API function SetWindowsPos() does not help, It only works with a form
> that have its MDIChild property set to false.
> On the Microsoft TechNet CD I found an article (article Q108315) dealing
> with the problem:
> "When creating a multiple document interface (MDI) window, there are no
> styles available to have the new window stay on top of the other MDI
> windows. Alternatively, two methods are available to achieve this
> functionality:
> - Process the WM_WINDOWPOSCHANGED message and call SetWindowPos() to
> change the Z-order of the window.
> - Install a timer for the MDI windows and reset the Z-order of the window
> when processing the WM_TIMER message."
> Does anybody know how to process the WM_WINDOWSPOSCHANGED message - are
> there any requirements like
> using Messageblaster etc...?
> Do You have an idea, suggestion or knowledges about this, please feel free
> to mail me:
> Regards
> Morten
You don't say whether you have win3.1 or win95. If you've got 3.1, then get hold of
MsgHook.VBX (It's on http://www.Shareware.com) This enables you to trap WM_ messages
and either handle them your self or pass them to the default window procedure. If you
then set the properties as below
wHandle = MDIForm.hWnd
MsgHook.HwndHook = wHandle
MsgHook.Message(WM_WINDOWSPOSCHANGED) = True
The control will provide an event every time the windows z-order changes. you can then
put the SetWindowPos API in this event. If your using Win95, try it, it might work
Hope this helps.
--
++++++++++++++++++++++++++++++++++++++++
| |
| Bill Martin |
| Halesowen College |
| |
| |
++++++++++++++++++++++++++++++++++++++++