FormOnTop (3)




'Inserire la seguente dichiarazione e le costanti

'in un modulo Bas


Public Const SWP_NOACTIVATE = &H10
Public Const SWP_SHOWWINDOW = &H40
Public Const HWND_TOPMOST = -1
Public Const HWND_NOTOPMOST = -2
Declare Function SetWindowPos Lib "user32" Alias "SetWindowPos" (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
Routine per impostare un form Always On Top:
Public Sub AlwaysOnTop(x as Form,Y as Boolean)
Select Case Y
Case = True
SetWindowPos x.hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE Or SWP_SHOWWINDOW
Case=False
SetWindowPos x.hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE Or SWP_SHOWWINDOW
End Select
End Sub











( formontop3.html )- by Paolo Puglisi - Modifica del 17/12/2023