PDA

Click to See Complete Forum and Search --> : How do I keep a form showing at all times


dmuir
Dec 4th, 1999, 05:02 AM
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

leif-p
Dec 4th, 1999, 07:01 AM
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!

dmuir
Dec 5th, 1999, 10:45 PM
Thanks, leif-p

It worked. That is just what I needed.