调用API Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _ (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Declare Function IsWindow Lib "user32" (ByVal hwnd As Long) As Long Dim lngAns As Long lngAns = FindWindow(vbNullString, "窗体的CAPTION") lngAns = IsWindow(lngAns) If lngAns <> 0 Then MsgBox "窗体已经被加载!", vbOKOnly End Else MsgBox "窗体未被加载!", vbOKOnly End If 方法2 Dim frm As Object
Dim blnFlag As Boolean For Each frm In Forms If frm.Caption = "FORM标题" Then blnFlag = True End If Next frm If blnFlag Then MsgBox "Form已经加载" Else MsgBox "Form未加载" End If |
|