My project has only one form. How can I make this form either:
1. Modal to all other applications - similar to a
MsbBox
2. Always visible - similar to a help dialog or an NT task
Manager
VBModal
Any help would be appreciated.
John
Printable View
My project has only one form. How can I make this form either:
1. Modal to all other applications - similar to a
MsbBox
2. Always visible - similar to a help dialog or an NT task
Manager
VBModal
Any help would be appreciated.
John
Try this:
Code: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
Global Const HWND_TOPMOST = -1
Global Const HWND_NOTOPMOST = -2
Global Const SWP_NOMOVE = 2
Global Const SWP_NOSIZE = 1
Global Const wFLAGS = SWP_NOMOVE Or SWP_NOSIZE
'To make your form TOPMOST:
SetWindowPos Me.hwnd, HWND_TOPMOST, 0, 0, 0, 0, wFLAGS
'To undo it:
SetWindowPos Me.hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, wFLAGS
Thanks!
It works great!