I need to force a child form to stay on top
until its unloaded or hidden. (vbmodal doesn't
work with child forms)
thank you
Printable View
I need to force a child form to stay on top
until its unloaded or hidden. (vbmodal doesn't
work with child forms)
thank you
Add the following to the LostFocus event of the Form you want to keep on top.
Code:Private sub Form_LostFocus
ZOrder
End Sub
Thanks Megatron!!!
How can you make either 2 forms stay ontop of all the others, or just one form stay always behind the others??
Thanx
VB Code:
' Declarations 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 Private Const SWP_NOMOVE = 2 Private Const SWP_NOSIZE = 1 Private Const FLAGS = SWP_NOMOVE Or SWP_NOSIZE Private Const HWND_TOPMOST = -1 Private Const HWND_NOTOPMOST = -2 ' Usage SetTopMostWindow Me.hwnd, True '******************************************************************************* ' SetTopMostWindow (FUNCTION) ' ' DESCRIPTION: ' SET TO TOP MOST FORM '******************************************************************************* Private Function SetTopMostWindow(hwnd As Long, Topmost As Boolean) As Long On Error GoTo ErrRtn If (Topmost) Then SetTopMostWindow = SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0, FLAGS) Else SetTopMostWindow = SetWindowPos(hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, FLAGS) SetTopMostWindow = False End If Exit Function ErrRtn: MsgBox "Error in SetTopMostWindow " & Err & " " & Error, vbExclamation + vbOKCancel End Function
I forgot something, its MDI stylez :P
n i thought I'd make it more tricky (cause i realized it wouldn't work otherwise)
can't use
zorder 1 ( I dont think, cause u can only use it once???)
There 4 forms, and 2 need to always be on top of the other 2, they are all mdi forms. Is it possible?
----------------------------------------
Geeze u reply fast, i push refresh once the page loads and I already had a massive reply.
Sure, if they are not MDI Children... ;)
Maybe I can solve this a different way...
Say I have a form, cannot be moved. It is an MDI child.
However I wish to resize it using the little blue resizing handles like the vb environment... Is it possible without creating another form?
(Im not re-creating a vb draw thingo, so don't freak, lol)
ciao