[RESOLVED] form zorder (form should be in the front until exit)
in a mdi form i have two forms one is using as a dialog box. the dialog form should be at the top until exit. it should not loss focus until it exit. so pls help me
Re: form zorder (form should be in the front until exit)
If you want to use MDI Child form for that then there is NO way to accomplish this due to VB's MDI limitations.
However, you can mimic floating child by making that form to be non-mdi (mdichild = false). If you want to try this then here is a code you would need (applies only to form that needs to be on top):
VB Code:
Option Explicit
Private Const GWL_HWNDPARENT = (-8)
Private Declare Function SetWindowLong Lib "user32" _
Alias "SetWindowLongA" _
(ByVal hwnd As Long, ByVal nIndex As Long, _
ByVal wNewLong As Long) As Long
Private Sub Form_Load()
Call SetWindowLong(Me.hwnd, GWL_HWNDPARENT, MDIForm1.hwnd)
End Sub
Private Sub Form_Unload(Cancel As Integer)
Call SetWindowLong(Me.hwnd, GWL_HWNDPARENT, MDIForm1.hwnd)
End Sub