Hi,
I'm controlling a 3rd party app by watching for dialog boxes it brings up and then closing them.
The code gets the list of windows, looks for a specific 1 and if it finds it, then closes it.
If it doesn't find the window, it waits a second, grabs a list of windows again and loops through them all again.
The problem is that the 2nd time I call getWindowList, it always returns no windows, unless I pass it a new 'unused' arraylist.
Any ideas?
Thanks
Kristian
I'm controlling a 3rd party app by watching for dialog boxes it brings up and then closing them.
Code:
Dim arraylistWindows2 As New ArrayList
Dim boolDialog_Closed As Boolean
Dim strError As String
boolDialog_Closed = False
Do While boolDialog_Closed = False
getWindowList(arraylistWindows2, strError)
For Each strList_Item In arraylistWindows2
If InStr(strList_Item, "Processing Experiment Script") Then
intHandle = Val(strList_Item)
PostMessage(intHandle, WM_CLOSE, 0, 0)
boolDialog_Closed = True
Exit For
End If
Next
arraylistWindows2.Clear()
Threading.Thread.Sleep(1000)
Loop
If it doesn't find the window, it waits a second, grabs a list of windows again and loops through them all again.
The problem is that the 2nd time I call getWindowList, it always returns no windows, unless I pass it a new 'unused' arraylist.
Any ideas?
Thanks
Kristian