Results 1 to 2 of 2

Thread: [RESOLVED] form zorder (form should be in the front until exit)

  1. #1

    Thread Starter
    Hyperactive Member binilmb's Avatar
    Join Date
    Nov 2005
    Location
    Kochi
    Posts
    472

    Resolved [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

  2. #2
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    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:
    1. Option Explicit
    2.  
    3. Private Const GWL_HWNDPARENT = (-8)
    4.  
    5. Private Declare Function SetWindowLong Lib "user32" _
    6.     Alias "SetWindowLongA" _
    7.    (ByVal hwnd As Long, ByVal nIndex As Long, _
    8.     ByVal wNewLong As Long) As Long
    9.  
    10. Private Sub Form_Load()
    11.     Call SetWindowLong(Me.hwnd, GWL_HWNDPARENT, MDIForm1.hwnd)
    12. End Sub
    13.  
    14. Private Sub Form_Unload(Cancel As Integer)
    15.     Call SetWindowLong(Me.hwnd, GWL_HWNDPARENT, MDIForm1.hwnd)
    16. End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width