Results 1 to 8 of 8

Thread: (vbmodal) for a child form

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Sep 2000
    Posts
    116

    Exclamation

    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
    0101011001000010
    01101111011011100110110001101001011011100110010101110010

  2. #2
    Guest
    Add the following to the LostFocus event of the Form you want to keep on top.
    Code:
    Private sub Form_LostFocus
        ZOrder
    End Sub

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Sep 2000
    Posts
    116

    Wink

    Thanks Megatron!!!
    0101011001000010
    01101111011011100110110001101001011011100110010101110010

  4. #4
    Hyperactive Member Wak's Avatar
    Join Date
    Nov 2000
    Location
    Brisbane, Queensland
    Posts
    298

    I got one 4 ya

    How can you make either 2 forms stay ontop of all the others, or just one form stay always behind the others??

    Thanx
    Visual Basic 6.0 Enterprise
    Visual C++ 6.0 Professional

    Wak

  5. #5
    PowerPoster
    Join Date
    Aug 2000
    Location
    IN SILENCE
    Posts
    6,441

    Well

    VB Code:
    1. ' Declarations
    2.  
    3. 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
    4.  
    5. Private Const SWP_NOMOVE = 2
    6. Private Const SWP_NOSIZE = 1
    7. Private Const FLAGS = SWP_NOMOVE Or SWP_NOSIZE
    8. Private Const HWND_TOPMOST = -1
    9. Private Const HWND_NOTOPMOST = -2
    10.  
    11. ' Usage
    12.  
    13. SetTopMostWindow Me.hwnd, True
    14.  
    15. '*******************************************************************************
    16. ' SetTopMostWindow (FUNCTION)
    17. '
    18. ' DESCRIPTION:
    19. ' SET TO TOP MOST FORM
    20. '*******************************************************************************
    21.  
    22. Private Function SetTopMostWindow(hwnd As Long, Topmost As Boolean) As Long
    23.    
    24.     On Error GoTo ErrRtn
    25.    
    26.     If (Topmost) Then
    27.        
    28.         SetTopMostWindow = SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0, FLAGS)
    29.    
    30.     Else
    31.        
    32.         SetTopMostWindow = SetWindowPos(hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, FLAGS)
    33.        
    34.         SetTopMostWindow = False
    35.    
    36.     End If
    37.    
    38.     Exit Function
    39.  
    40. ErrRtn:
    41.    
    42.     MsgBox "Error in SetTopMostWindow " & Err & " " & Error, vbExclamation + vbOKCancel
    43.  
    44. End Function
    Remaining quiet down here !!!

    BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....

  6. #6
    Hyperactive Member Wak's Avatar
    Join Date
    Nov 2000
    Location
    Brisbane, Queensland
    Posts
    298

    oi, lol

    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.
    Visual Basic 6.0 Enterprise
    Visual C++ 6.0 Professional

    Wak

  7. #7
    PowerPoster
    Join Date
    Aug 2000
    Location
    IN SILENCE
    Posts
    6,441

    Well

    Sure, if they are not MDI Children...
    Remaining quiet down here !!!

    BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....

  8. #8
    Hyperactive Member Wak's Avatar
    Join Date
    Nov 2000
    Location
    Brisbane, Queensland
    Posts
    298

    mmm

    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
    Visual Basic 6.0 Enterprise
    Visual C++ 6.0 Professional

    Wak

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