你可以用对象变量。
Dim fm as From1
set fm=new From1
load fm
fm.show
if (fm is nothing ) then
    MsgBox("Null!")
End If

解决方案 »

  1.   

    调用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.   

    if form1 is nothing then
       MsgBox "Form未加载"
    else
       MsgBox "Form已加载"
    end if建议不要用KillerAPP的那种方法,因为不同窗体会有相同CAPTION的.尤其是在WINDOWS中.
      

  3.   

    James,你说的方法根本不行,在系统一开始运行,该系统的所有Form都会被加载,只要系统还在运行,form1就不会为Nothing.其实一个控制一个系统form的Caption还是很容易办到的...
      

  4.   

    Sorry, 刚才的方法的确不行!以下方法完全可以,仅供参考(枚举)    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
      

  5.   

    Sorry, 刚才的方法的确不行!以下方法完全可以,仅供参考(枚举)    Dim frm As Object
        Dim blnFlag As Boolean
        For Each frm In Forms
            If frm.Caption = "FORM标题" Then
                blnFlag = True
                Exit For
            End If
        Next frm
        If blnFlag Then
            MsgBox "Form已经加载"
        Else
            MsgBox "Form未加载"
        End If
      

  6.   

    建议使用boyold的方法,通过创建一个窗体实例来控制窗体比较可靠。最好的办法是建立一个类来管理所有的窗体调用。
      

  7.   

    boyold那个方法也不行
    既然原窗体处于加载,那它的实例也是处于加载的,所以通过判断form是否为nothing是行不通的...