Ejemplo n.º 1
0
        private const string PrimaryClassName = "Shell_TrayWnd";                                              //Name of taskbar class

        static void CheckTaskbar()
        {
            if (PrimaryClassName == TopLevelWindowUtils.GetForegroundWindow().GetClassName())//Checking on selected taskbar
            {
                user32.keybd_event(0, 0, 0, 0);
                user32.SetForegroundWindow(user32.GetDesktopWindow());//not work without click(previous line)
            }
        }
        public void ShowForeground()
        {
            var windowHandle = TopLevelWindowUtils.GetForegroundWindow();

            Console.WriteLine(windowHandle.GetWindowText());
        }
Ejemplo n.º 3
0
        public static List <WindowHandle> GetWindows()
        {
            WindowHandle current = TopLevelWindowUtils.GetForegroundWindow();

            return(TopLevelWindowUtils.FindWindows(wh => wh.IsValid && wh.IsVisible() && wh.RawPtr != current.RawPtr).ToList());
        }