How to keep a form above everything, including windows gui elements?

  • Thread starter Thread starter Matthew Judd
  • Start date Start date
M

Matthew Judd

How can I keep a windows form on top of everything,
including windows elements, like the start menu? I know
the forms TopMost property, but the start/programs menu
will come up over the top of it, and so will other
TopMost programs, like Taskmanager. Is there something
else I can use, and API call maybe?

Thanks.

Matthew Judd
 
Hi Matthew,

As I know, in win32 there is no method to make a window "absolute top
most". the latter topmost window will be front of the former topmost
window.
However, if you only have one window want to make topmost, you may try
using a timer,
set TopMost = true in the event handler.

Also if you'd like to know more about Win32 Window Hierarchy and Styles,
you may read the following Technical Article:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwui/html/
msdn_styles32.asp

Does it solve your problem?
If you have anything unclear about this issue, please be free to reply
this thread to let me know.
Thanks!



Best regards,

Ying-Shen Yu [MSFT]
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security

This posting is provided "AS IS" with no warranties and confers no rights.
You should not reply this mail directly, "Online" should be removed before
sending.
 
Thanks, resetting the TopMost to true on a timer, does
keep it in front, but it is not very efficient. Is there
an event that is triggered when the form is no longer on
top, that I could monitor instead?

Matthew Judd
 
Hi Matthew,

Thanks for your reply!

Unfortunately, there is no event to tell the window that the window is no
long on top. The window will get WM_PAINT message when a window above it is
moving away, however there's no event to tell the moving on. That's why I
use a timer.
However, after some further test, It seems this approach has some
limitations, you can't not use combobox nor open a new dialog, because the
new window(dropdownlist and dialog window) will be in front of the main
window, which will be send to back. That's a reason why we will not have
the "absolutely topmost window".

I hope this will be helpful to you, if you still have problem on this
issue, could you let me know what do you want to do? Maybe we can find some
alternatives.

Thanks!


Best regards,

Ying-Shen Yu [MSFT]
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security

This posting is provided "AS IS" with no warranties and confers no rights.
You should not reply this mail directly, "Online" should be removed before
sending.
 
Back
Top