by Oompa L. Standwiggalman (1 Submission)
Category: Windows API Call/Explanation
Compatability: Visual Basic 4.0 (32-bit)
Difficulty: Unknown Difficulty
Originally Published: Sat 4th November 2000
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Stay On Top Only One Line of Code After Declarations!!!
API Declarations
Public Const HWND_TOPMOST = -1
Public Const HWND_NOTOPMOST = -2
Public Const SWP_NOSIZE = &H1
Public Const SWP_NOMOVE = &H2
Public Const OOMPS = SWP_NOSIZE Or SWP_NOMOVE
'Ex. (Form1.hwnd)
'Put this code in form load
'Here is the Code to Keep Your form on top
Call SetWindowPos(Formname.hwnd, HWND_TOPMOST, 0&, 0&, 0&, 0&, OOMPS)
'And Here is the Code to make your form not on top anymore
Call SetWindowPos(Formname.hwnd, HWND_NOTOPMOST, 0&, 0&, 0&, 0&, OOMPS)