Hmm, I cant seem to figure out how I can get my forms to stay on top or infront of all other applications even when they arnt the active window, Help!
Printable View
Hmm, I cant seem to figure out how I can get my forms to stay on top or infront of all other applications even when they arnt the active window, Help!
To keep a form on top:
Code: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
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
Private Sub Form_Load()
ontop& = SetWindowPos(Me.hWnd, HWND_TOPMOST, _
0, 0, 0, 0, FLAGS)
End Sub
'Off top:
ontop& = SetWindowPos (Me.hWnd, HWND_NOTOPMOST, _
0, 0, 0, 0, FLAGS)
Another way:
Code:Form1.Show vbModal
That will work if you are looking to put the form in front of every other form, but it will not work when keeping your application on top of every other application.Quote:
Originally posted by sanon
Another way:
Code:Form1.Show vbModal
Thanks for the help