-
Hi,
Does anyone know how to keep a form showing at all times above another form. I need to be able to work on the bottom form while the other is above it.
I need to have something sort of like a legend key that is always there. My problem with the .show command is that if I use vbModal, I cannot click on the form below the top one. If I don't use vbModal, when I click the bottom form, the top form disappears under the bottom one.
Any help would be greatly appreciated.
Thanks,
dmuir
-
Dear DMuir:
Put in a module file (.bas) the commands:
Public Const HWND_TOPMOST = -1
Public Const HWND_NOTOPMOST = -2
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
'then, out in the program, to keep Form1 on top, use the command
Form1.Show
success% = SetWindowPos(Form1.hWnd, HWND_TOPMOST, 0, 0, 0, 0, flags)
'to prevent Form1 from being on top use
unload Form1
success% = SetWindowPos(Form1.hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, flags)
That should work,
Good luck!
-
Thanks, leif-p
It worked. That is just what I needed.