Find all our projects in development below.
All source code is GNU General Public License (GPL)
Browsing WindowOnTopMod.bas (752 B)
Attribute VB_Name = "WindowOnTopMod"
Private Const HWND_TOPMOST = -1
Private Const HWND_NOTOPMOST = -2
Private Const SWP_NOMOVE = &H2
Private Const SWP_NOSIZE = &H1
Private Const SWP_NOACTIVATE = &H10
Private Const SWP_SHOWWINDOW = &H40
Private Declare Function SetWindowPos Lib "user32" (ByVal hWnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal CX As Long, ByVal CY As Long, ByVal wFlags As Long) As Long
Public Sub AlwaysOnTop(frmObject As Form, bOnTop As Boolean)
Dim wFlag As Long
If bOnTop Then
wFlag = HWND_TOPMOST
Else
wFlag = HWND_NOTOPMOST
End If
SetWindowPos frmObject.hWnd, wFlag, 0, 0, 0, 0, SWP_NOACTIVATE Or SWP_NOMOVE Or SWP_NOSIZE
End Sub