Using EnumChildWindows crash my application
Posted on 2004-05-02
I am trying to track down another app by its name and kill it. I am almost successful, I do a EnumWindows and check the window names in a call back function.
I check that the window doesnt have a parent and matches the name and then I add it to my dletion container. afterwards when im done with the loop I kill it.
the window is killed. but if it has a modal window open, the modal window is not. I am trying to once adding the window for deletion, EnumChildWindows. But when I come back from the Call back function, my whole app crashes. why??
some code Inside first Callback:
If Left$(str2, Len(searchText)) Like searchText Then
lParent = GetParent(hwnd)
If lParent = 0 Then
EnumChildWindows hwnd, AddressOf fEnumChildWindowsCallBack, 0
text = str
.... and My callback:
Declare Function EnumChildWindows Lib "user32" (ByVal hwnd As Long, ByVal lpEnumFunc As Long, ByVal lparam As Long) As Long
Public Function fEnumChildWindowsCallBack(ByVal hwnd As Long, ByVal lparam As Long)
fEnumChildWindowsCallBack = False
anotehr pecuiar thing.. if I use a debugger.. even my debugger crash after end function statement of the callback..