API函数 Public Declare Function OpenIcon Lib "user32" (ByVal hwnd As Long) As Long Dim frmNew As Form For Each frmNew In Forms If frmNew.Name = 要找的窗体名称 Then msgbox "找到了" End If Next
可见吗,可以用:Private Declare Function IsWindowVisible Lib "user32" Alias "IsWindowVisible" (ByVal hwnd As Long) As Long
好象只有用Forms集合啦! 否则,任何对窗体属性的引用都会导致窗体的隐性加载,本来没初始化的,也被你加载了。Dim frmNew As Form For Each frmNew In Forms If lcase$(frmNew.Name) = lcase$(要找的窗体名称) Then msgbox "找到了" if frmNew.visible then msgbox "可见" End If Next
Public Declare Function OpenIcon Lib "user32" (ByVal hwnd As Long) As Long Dim frmNew As Form
For Each frmNew In Forms
If frmNew.Name = 要找的窗体名称 Then
msgbox "找到了"
End If
Next
否则,任何对窗体属性的引用都会导致窗体的隐性加载,本来没初始化的,也被你加载了。Dim frmNew As Form
For Each frmNew In Forms
If lcase$(frmNew.Name) = lcase$(要找的窗体名称) Then
msgbox "找到了"
if frmNew.visible then msgbox "可见"
End If
Next