GetFocusedWindowHandle() public static method

public static GetFocusedWindowHandle ( ) : IntPtr
return System.IntPtr
Exemplo n.º 1
0
        // Runs on the Automation thread (before syncContextAuto starts pumping)
        public void TryInitialize()
        {
            Debug.Print("### WindowWatcher TryInitialize on thread: " + Thread.CurrentThread.ManagedThreadId);
            var    focusedWindowHandle = Win32Helper.GetFocusedWindowHandle();
            string className           = null;

            if (focusedWindowHandle != IntPtr.Zero)
            {
                className = Win32Helper.GetClassName(focusedWindowHandle);
            }

            UpdateFocus(focusedWindowHandle, className);
        }