Home All Groups Group Topic Archive Search About

Keep form on top of everything - even other apps ?

Author
14 Jan 2006 8:50 PM
Rob
Is there a way to keep a form on top of everything - even other apps ?

Author
14 Jan 2006 9:52 PM
AMercer
> Is there a way to keep a form on top of everything - even other apps ?

TopMost = True
Author
15 Jan 2006 3:15 AM
Cyril Gupta
Hello,

I don't think TopMost = True will do it. In most probability it will keep
your form on top of your current app only.

I think there is an API called SetWindowPos that is used for this purpose. I
used it back in good ol' days of VB not Net.

If you look for the SetWindowPos keyword, you can probably find some
examples on the net.

Regards
Cyril
Author
15 Jan 2006 10:45 AM
AMercer
> I don't think TopMost = True will do it. In most probability it will keep
> your form on top of your current app only.

It works for me (topmost means on top of all apps) under XP 5.1 SP 2 Build
2600, FW 1.1 SP1.  But there is this in the .net help files:

"With the Microsoft Windows 2000 operating system, a top-most form always
stays in front of all windows in a given application. In Microsoft Windows
98, a top-most form stays in front of all windows in all applications. For
example, you may want to keep a floating tool window in front of your
application's main window. The TopMost property controls whether a form is a
top-most form. Note that a top-most form will float above other, non–top-most
forms even when it is not active."
Author
15 Jan 2006 11:40 AM
Cyril Gupta
Hmm... That's weird behaviour :)

Well.. I guess for insurance it might be a good idea to use the API. I have
always used it.

Thanks for the tip AMercer, this is something I didn't know

Regards
Cyril