Sign in to follow this  
Followers 0
Guest Greg Thomas

Waiting for more than one window

2 posts in this topic

I've a VB program using the ActiveX DLL. After clicking on a button, depending on something outside of my control, one of three windows will (eventually) appear. Is there an easy way to wait for one of the three to arrive? At the moment, I've got something like

Do
  If autoIt.WinWait("Window 1", "", 1) = 1 Then 
    WinFound = 1
  ElseIf autoIt.WinWait("Window 2", "", 1) = 1 Then 
    WinFound = 2
  ElseIf autoIt.WinWait("Window 3", "", 1) = 1 Then 
    WinFound = 3
  End If
Loop While WinFound = 0
This works, but it does mean that there is a few seconds delay, depending on where in the loop you are, before the program continues. Of course, the more windows you are looking for, the worse the delay is!

I suppose I could use WinExists() to get an instant result, with a Sleep() to stop the loop from burning CPU, but there is still a delay in waiting for the Sleep() to finish. I wonder if anyone can think of a better way of doing it?

I guess what I really want is WinWaitOr(), which takes an array of window titles/texts. returning the index of the array of the window it found.

Thanks,

Greg

Share this post


Link to post
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0