To make your window always on top regardles of the focus you need to use
API functions:
'Win32API functions
Private
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
'Win32API constants
Private Const HWND_TOPMOST = -1
Private Const HWND_NOTOPMOST = -2
Private Const SWP_NOSIZE = &H1
Private Const SWP_NOMOVE = &H2
If you want to make your window always on top use this one:
SetWindowPos Me.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE Or
SWP_NOMOVE
If you don't want your window to be always on top you need to use this:
SetWindowPos Me.hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE Or
SWP_NOMOVE
Partager