How to Keep an MDI Window Always on Top 
Author Message
 How to Keep an MDI Window Always on Top

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



Sat, 31 Jul 1999 03:00:00 GMT  
 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           |
|                                      |


|                                      |
++++++++++++++++++++++++++++++++++++++++



Sun, 01 Aug 1999 03:00:00 GMT  
 How to Keep an MDI Window Always on Top

Hi Bill,
Thank you for your answer.Your advise solved my problems.

I found the MsgHook extionsion at http://www.softcircuits.com/sw_tools.html
 (and its freeware)!
The package incl., besides a 16bit VBX  and a  16 bit OCX , also a 32 bit
OCX (Im developing on NT.)

Regards
Morten



Quote:

> > 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           |
> |                                      |


> |                                      |
> ++++++++++++++++++++++++++++++++++++++++



Sun, 01 Aug 1999 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Keeping an MDI-Window Always on Top

2. How to keep MDI Child always on top

3. How to keep an MDI child always on top

4. Keep my window, always on top?

5. Can I keep a window always on top using VBscript open (clientside)

6. Make a window always on top (of every window..always)

7. MDI Child Always on top....dockable Window??

8. Keeping a Form Always On Top

9. Keep a VB5 form always on top ???

10. Always keep a form on top

11. Keeping VB forms always on Top - SetWindowPos behavior?

12. how do you keep a vb app always on top

 

 
Powered by phpBB® Forum Software