How do I do to keep an window allways ont top ?
Nankien
Printable View
How do I do to keep an window allways ont top ?
Nankien
Paste this into a module
you can then pass the form name as a parameter
Code:
Public Const HWND_TOPMOST = -1
Public Const HWND_NOTOPMOST = -2
Public Const SWP_NOACTIVATE = &H10
Public Const SWP_SHOWWINDOW = &H40
Declare Sub 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)
Sub NotOnTop(Form As Form)
SetWindowPos Form.hwnd, HWND_NOTOPMOST, Form.Left / 15, _
Form.Top / 15, Form.Width / 15, _
Form.Height / 15, SWP_NOACTIVATE Or SWP_SHOWWINDOW
End Sub
''''''''''''''''''
Sub OnTop(Form As Form)
SetWindowPos Form.hwnd, HWND_TOPMOST, Form.Left / 15, _
Form.Top / 15, Form.Width / 15, _
Form.Height / 15, SWP_NOACTIVATE Or SWP_SHOWWINDOW
End Sub