很简单,使用SetParent函数即可Option Explicit '创建一个工程,添加两个窗体,Form1、Form2 Form1是启动窗体 '以下是Form1中的代码 Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long Private Sub Command1_Click() Dim lngP As Long Form2.Show lngP = SetParent(Form2.hWnd, Form1.hWnd) End SubPrivate Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) End End Sub
'创建一个工程,添加两个窗体,Form1、Form2 Form1是启动窗体
'以下是Form1中的代码
Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
Private Sub Command1_Click()
Dim lngP As Long
Form2.Show
lngP = SetParent(Form2.hWnd, Form1.hWnd)
End SubPrivate Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
End
End Sub