V
Vincent
I have a chunk of code that is calling the EnumWindows function that is
part of the Windows API. This function requires a callback function as
one of its parameters. The code for my callback function is as
follows:
'********************************************************************************************************
Public Function EnumWindowProc(ByVal hwnd As Long, ByVal lParam As
Long) As Long
Dim ret As Long
Dim strClass As String
strClass = Space$(256)
ret = GetClassName(hwnd, strClass, Len(strClass))
If (ret) Then strClass = Left$(strClass, ret)
Debug.Print str$(hwnd) + " - " + strClass
If strClass = "AMisBehavedApplication" Then
If (Not IsWindowVisible(hwnd)) Then SendMessage hwnd, WM_CLOSE,
0, 0
End If
EnumWindowsProc = 1
End Function
'********************************************************************************************************
false or all windows have been enumerated. When I run my code, the
callback function is only called once. Why is this occurring? Any
help is appreciated. Thank you.
-Vincent
part of the Windows API. This function requires a callback function as
one of its parameters. The code for my callback function is as
follows:
'********************************************************************************************************
Public Function EnumWindowProc(ByVal hwnd As Long, ByVal lParam As
Long) As Long
Dim ret As Long
Dim strClass As String
strClass = Space$(256)
ret = GetClassName(hwnd, strClass, Len(strClass))
If (ret) Then strClass = Left$(strClass, ret)
Debug.Print str$(hwnd) + " - " + strClass
If strClass = "AMisBehavedApplication" Then
If (Not IsWindowVisible(hwnd)) Then SendMessage hwnd, WM_CLOSE,
0, 0
End If
EnumWindowsProc = 1
End Function
'********************************************************************************************************
the callback function until the callback function returns a value ofFrom what I have read, the EnumWindows function should repeatedly call
false or all windows have been enumerated. When I run my code, the
callback function is only called once. Why is this occurring? Any
help is appreciated. Thank you.
-Vincent