Private Sub Command1_Click()
Form3.Show , Me '参数me一定要加上,不加的话其onwer为vb的虚拟机
End Sub
窗体2:
Option Explicit
Private Sub Command1_Click()
Form3.Show , Me '参数me一定要加上,不加的话其onwer为vb的虚拟机
End Sub
窗体3:
Option Explicit
Private Const GW_OWNER = 4
Private Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal wCmd As Long) As Long
Private Sub Command1_Click()
Dim mhwnd As Long
mhwnd = GetWindow(Me.hwnd, GW_OWNER)
Dim a As Form
For Each a In Forms
If a.hwnd = mhwnd Then
MsgBox "打开我的是:" + a.Name
Exit For
End If
Next
Set a = Nothing
End Sub