Forum Discussion

MarkCrossland's avatar
MarkCrossland
New Contributor
16 years ago

Multiple WaitWindow in order to get a specific window

Hello,



I have a need to get and use windows without it putting an error in the TestComplete log. The following will put an error in the log as the first window cannot always be found and may not be the correct one:



Set oMessageBox = Sys.Process("mmc").Window("#32770", strTitle).WaitWindow("Static", "*" & strMessageTextFilter & "*", -1, 30000)



I could do the following:



Set oMessageBox1 = Sys.Process("mmc").WaitWindow("#32770",
strTitle, -1, 30000)

Set oMessageBox2 = oMessageBox1.WaitWindow("Static", "*" & strMessageTextFilter & "*",
-1, 30000)



But was wondering if I could do the following instead:



Set oMessageBox1 = Sys.Process("mmc").WaitWindow("#32770",
strTitle, -1, 30000).WaitWindow("Static", "*" & strMessageTextFilter & "*",
-1, 30000)



And wondered whether it would produce any problems, especially if the first window is not found?



Thanks.

2 Replies