Reputation: 179
In my application in VB.NET, I have started an application and introduced a wait delay of 20 seconds. But for loading the second application, the time is varying. Is it possible to have a do while loop, similar to the structure as shown below:
Start the application1
do {
sleep(2seconds)
}until(Application1 Window is loaded
Upvotes: 2
Views: 1847
Reputation: 754565
The biggest obstacle you're going to face is how the child process communicates that it's ready. Determining if another process's window is loaded is shaky at best. It's much cleaner if you decide on something more definitive
Once you decide on that then it's fairly straight forward loop
Dim span = TimeSpan.FromSeconds(20)
Thread.Sleep(span)
Do While Not IsProcessReady()
Thread.Sleep(span)
Loop
As said before you'll need to pick a mechanism to communicate "loaded" and that becomes your IsProcessReady
function
Upvotes: 1