窗体: sub sub_sub EnumWindows AddressOf EnumWindowsProc, 0 end sub模块:Public Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As LongFunction EnumWindowsProc(ByVal hwnd As Long, ByVal parma As Long) As Long
Dim astr As String * 256
GetWindowText hwnd, astr, Len(astr)
If InStr(1, astr, "Microsoft Excel") > 0 Then gblnFindExcel = True lngHwnd = hwnd MsgBox "Please close all EXCEL window and try again!", vbInformation Exit Function End If
sub sub_sub
EnumWindows AddressOf EnumWindowsProc, 0
end sub模块:Public Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As LongFunction EnumWindowsProc(ByVal hwnd As Long, ByVal parma As Long) As Long
Dim astr As String * 256
GetWindowText hwnd, astr, Len(astr)
If InStr(1, astr, "Microsoft Excel") > 0 Then
gblnFindExcel = True
lngHwnd = hwnd
MsgBox "Please close all EXCEL window and try again!", vbInformation
Exit Function
End If
EnumWindowsProc = True
End Function
这是怎么回事?????
谢谢你了。