Add this to your module
Declare Function
SetWindowPos Lib "user32" _
(ByVal h%, ByVal hb%, ByVal x%, ByVal y%, _
ByVal cx%, ByVal cy%, ByVal f%) As Integer
Global Const SWP_NOMOVE = 2
Global Const SWP_NOSIZE = 1
Global Const FLAGS = SWP_NOMOVE Or SWP_NOSIZE
Global Const HWND_TOPMOST = -1
Global Const HWND_NOTOPMOST = -2
Add this code to your module
Public Sub
Form_OnTop(Form As Form)
Dim lResult As Long
lResult& =
SetWindowPos(Form.hwnd, HWND_TOPMOST, 0&, 0&,
0&, 0&, FLAGS)
End Sub
Public Sub Form_NotOnTop(Form As Form)
Dim lResult As Long
lResult& =
SetWindowPos(Form.hwnd, HWND_NOTOPMOST, 0&,
0&, 0&, 0&, FLAGS)
End Sub
Tip submitted by Jesse McAllister
|