请教VB6的窗体嵌入问题。想把一些窗体动态的显示到主窗体界面中,但不想用MDI窗体。请问有什么好方法?

解决方案 »

  1.   

    相关api声明 略Public Sub Main()
        Dim lStyle   As Long    Load DlgLoginParent
        Load DlgChildLogin
        
        With DlgChildLogin
            lStyle = GetWindowLong(.hwnd, GWL_STYLE)
            lStyle = lStyle Or WS_CHILD Or WS_POPUP
            
            '*** Set the Style Attributes to the DlgChildLogin form
            Call SetWindowLong(.hwnd, GWL_STYLE, lStyle)
            
            '*** Make the DlgChildLogin form a Child of the DlgLoginParent form
            Call SetParent(.hwnd, DlgLoginParent.hwnd)
            
            '*** Set the Parent Style Attribute to the DlgLognParent form
            Call SetWindowLong(.hwnd, GWL_HWNDPARENT, DlgLoginParent.hwnd)
            
        End With    '*** Show the Child and Parent Forms
        DlgChildLogin.Show
        DlgLoginParent.Show
        
        '*** Set the focus on the Child Form
        DlgChildLogin.SetFocus
        
    End Sub
      

  2.   

    ch21st(风尘鸟) 非常感谢你的回答,我先试试看。