唉。这样
Public Function EnumProc(ByVal app_hwnd As Long, ByVal lParam As Long) As Boolean '遍查主窗口
Dim buf As String * 1024
Dim length As Long
length = GetWindowText(app_hwnd, buf, Len(buf))
title = Left$(buf, length)
If InStr(title, "OICQ用户登录") Then '判断是否为 OICQ 窗口
是这个窗体的话
End If
If title <> "" Then
If InStr(titleall, title) Then
EnumProc = 1
Else
XXXX
End If
End If
EnumProc = 1
你可以用查找该窗口的名称(是Name,不是Caption)是否存在于所有已经LOAD的窗口之中,请看下面的函数:
Function FindWin(ByVal strFormName As String) As Boolean
Dim frmForm As Form
FindWin = False
For Each frmForm in Forms
If Trim(frmForm.Name)=Trim(strFormName) Then
FindWin = True
Exit For
End If
Next frmForm
End Function
如果FindWin=True表示该窗口已经加载,否则没有加载!