这样: 1 //点A中某按钮用b.show调出B窗口 将A.C中的:b.show 修改为: b.show ,me 2 在b中添加一个按钮,并加入下面的代码: Option ExplicitPrivate Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal wCmd As Long) As Long Private Const GW_OWNER = 4Private Sub Command1_Click() Dim mhwnd As Long mhwnd = GetWindow(Me.hwnd, GW_OWNER) If mhwnd = 0 Then Exit Sub Dim m As Form For Each m In Forms If m.hwnd = mhwnd Then MsgBox "form2的owner为:" + m.Name Exit Sub End If Next End Sub
1 //点A中某按钮用b.show调出B窗口
将A.C中的:b.show
修改为:
b.show ,me
2 在b中添加一个按钮,并加入下面的代码:
Option ExplicitPrivate Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal wCmd As Long) As Long
Private Const GW_OWNER = 4Private Sub Command1_Click()
Dim mhwnd As Long
mhwnd = GetWindow(Me.hwnd, GW_OWNER)
If mhwnd = 0 Then Exit Sub
Dim m As Form
For Each m In Forms
If m.hwnd = mhwnd Then
MsgBox "form2的owner为:" + m.Name
Exit Sub
End If
Next
End Sub
什么A 中,什么又A.C中……后边的代码加点注释好不好呀?
我觉得调B窗时不用隐藏前窗口,只是ENABLE变为FALSE就可以呀,哪有这么麻烦呀……
……
当A-->B的时候
在A中写代码
b.show
callfrom="A"当C-->的时候
在C中写代码
b.sho
callfrom="C"在B中判断callfrom的值就好了。希望有帮助