title: How can I use EnumWindows to find windows with a specific caption/title?
body: <p>I am working on an application that will eventually be an api for driving UI Tests for a WPF application.</p>
  
  <p>At one point of the initial test we are working on, we get 2 Windows security popups.
  We have some code that loops 10 times, it gets the handle of one of the popups using the FindWindowByCaption method and enters the information and clicks ok.</p>
  
  <p>9 times out of 10 this works just fine, however we are occasionally seeing what looks to be a race condition. My suspicion is that the loop starts when only one of the windows is open and while its entering the information the second one opens and steals focus; after this it just hangs indefinitely.</p>
  
  <p>What I'm wondering is if there is any method to get all of the window handles for a given caption, so that we can wait until there are 2 before starting the loop.</p>