FormOnTop (5)




'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











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