• Welcome to PlanetSquires Forums.
 

Always on top

Started by Bumblebee, November 26, 2021, 04:24:30 PM

Previous topic - Next topic

Bumblebee

How would I go about creating a window or form that remains always on top?
Failed pollinator.

David Kenny

Take a look at SetWindowPos, the second parameter should be HWND_TOPMOST.

Paul Squires

David beat me to it as I was testing code to post! First time I've coded in WinFBE in a while and I lost out on providing the answer. LOL


''
''
Function frmMain_Load( ByRef sender As wfxForm, ByRef e As EventArgs ) As LRESULT

   SetWindowPos( sender.hWindow, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE or SWP_NOSIZE )
   
   Function = 0
End Function

Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

David Kenny

Well, since I didn't provide a tested example, your post is more useful.  :)

Bumblebee

Excellent, this does the trick. Thanks again!
Failed pollinator.

Petrus Vorster

Out of pure curiosity, the TOPMOST setting in a SetwindowsPOS, will it keep your form on top no matter what?

I was wondering what happens if you call other programs or forms with that setting, or will it keep the last called one on top?
Just curious if you have more than one of these what happens?

Regards, Peter
-Regards
Peter

Bumblebee

Calling another program where it is set to always be on top, does place it on top.
Failed pollinator.