VB 6 - Form Always on Top

View previous topic View next topic Go down

VB 6 - Form Always on Top

Post  Admin on Wed Apr 14, 2010 3:07 pm

Module1

Public Const SWP_NOMOVE = 2
Public Const SWP_NOSIZE = 1
Public Const FLAGS = SWP_NOMOVE Or SWP_NOSIZE
Public Const HWND_TOPMOST = -1
Public Const HWND_NOTOPMOST = -2

Public 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 Function SetTopMostWindow(hwnd As Long, _
Topmost As Boolean) As Long
If Topmost = True Then
'Make the window topmost
SetTopMostWindow = SetWindowPos(hwnd, HWND_TOPMOST, _
0, 0, 0, 0, FLAGS)
Else
'Make the window not topmost
SetTopMostWindow = SetWindowPos(hwnd, HWND_NOTOPMOST, _
0, 0, 0, 0, FLAGS)
SetTopMostWindow = False
End If
End Function



And In Form Load

SetTopMostWindow Me.hwnd, True
avatar
Admin
Admin

Posts : 256
Join date : 2008-06-06

View user profile http://debmedia.forumotion.com

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum