Как использовать EnumWindows для поиска окон с определенным заголовком

Материал из Wiki Test Lab
Перейти к: навигация, поиск

Назад    Главная
 

Как использовать EnumWindows для поиска окон с определенным заголовком

I am working on an application that will eventually be an api for driving UI Tests for a WPF application. 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. 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. 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.

Читать дальше...

Личные инструменты