UiaControlsTest.TargetApp.WaitForWindow C# (CSharp) Method

WaitForWindow() public static method

public static WaitForWindow ( int pid, string className, string windowTitle ) : IntPtr
pid int
className string
windowTitle string
return System.IntPtr
        public static IntPtr WaitForWindow(int pid, string className, string windowTitle)
        {
            // Try up to 80 times, 1/2 sec apart (40 secs max)
            // Extended this from 8 secs, since sometimes WCP can take ~35 secs to start
            // cold on a slow machine or on ia64.
            // Bump this again because ia64 machine is doing software acceleration so it takes a very
            // long time to come up.   Try 240 times for ~2 minutes.
            for (var attempt = 0; attempt < 240; attempt++)
            {
                var hwnd = TryFindWindowNow(pid, className, windowTitle);
                if (hwnd != IntPtr.Zero)
                {
                    return hwnd;
                }
                Thread.Sleep(500);
            }
            return IntPtr.Zero;
        }

Same methods

TargetApp::WaitForWindow ( ) : void