
Make a form always on top - always
I need to make a form that is ALWAYS on top of every other form. I can
create a form from the example in Vis. Studio help that stays on top most of
the time. But if I minimize a form underneath mine and then restore that
form from the task bar it covers mine up. What I require is a form that
will not be covered by anything as long as its open. Can the Z order for a
form be coded to always be first? The following is the code I have tried.
Developing with VB6.0
************************
In module:
Option Explicit
Declare Function 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) As Long
Public Const conHwndTopmost = -1
Public Const conHwndNoTopmost = -2
Public Const conSwpNoActivate = &H10
Public Const conSwpShowWindow = &H40
******************
In form:
Option Explicit
Private Sub Form_Load()
SetWindowPos hWnd, conHwndTopmost, 100, 100, 300, 300,
conSwpNoActivate Or conSwpShowWindow
End Sub
Any help greatly appreciated.
Thanks
Alan in San Antonio