Does anyone know how to make an MDIChild form stay on top of other MDIChild forms.
Thanks,
Patrick.
Printable View
Does anyone know how to make an MDIChild form stay on top of other MDIChild forms.
Thanks,
Patrick.
Not at all sure on this but you might want to investigate the BringWindowToTop API function.
this function will force a window to always be on top. It doesn't obey the MDI child rules though, :(
public Const SWP_NOMOVE = 2
public Const SWP_NOSIZE = 1
public Const FLAGS = SWP_NOMOVE Or SWP_NOSIZE
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
public Sub MakeTopMost(hwnd as Long, optional Topmost as Boolean = true)
If Topmost = true then 'Make the window topmost
Call SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0, FLAGS)
else
Call SetWindowPos(hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, FLAGS)
End If
End Sub
call it like this to turn it on:
Call MakeTopMost(Form1.hwnd, true)
and to turn it off:
Call MakeTopMost(Form1.hwnd, false)
hope this helps,
john
John Pirkey
MCSD
http://www.ShallowWaterSystems.com
http://www.stlvbug.org