Click to See Complete Forum and Search --> : Always On Top


Gili
October 23rd, 1999, 10:50 PM
Does anyone know how to make a VB form - Always On Top ? (with VB coding, please ...)

smalig
October 24th, 1999, 04:46 AM
This should be placed in the module:

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
Const conHwndTopmost = -1
Const conHwndNoTopmost = -2
Const conSwpNoActivate = &H10
Const conSwpShowWindow = &H40

--------------------------------------------------------------------------------

Use this in the event you want to set it topmost:


code:
--------------------------------------------------------------------------------

SetWindowPos hWnd, conHwndTopmost, 0, 0, 0, 0, conSwpNoActivate Or conSwpShowWindow
SetWindowPos hWnd, conHwndNoTopmost, 0, 0, 0, 0, conSwpNoActivate Or conSwpShowWindow


smalig@hotmail.com
http://smalig.tripod.com