private void CheckWindows()
        {
            busy = true;
            UpdatedOpenedWindows.Clear();
            WINAPI.EnumWindows(CountCallback, 0);
            var WindowsStillOpen = OpenedWindows.Intersect(UpdatedOpenedWindows);
            var WindowsToClose   = OpenedWindows.Except(WindowsStillOpen).ToList();
            var WindowsToOpen    = UpdatedOpenedWindows.Except(WindowsStillOpen).ToList();

            foreach (long l in WindowsToClose)
            {
                int index = OpenedWindows.FindIndex(x => x == l);
                if (index != -1)
                {
                    OpenedWindowsGUIItems[index].Destroy();
                    OpenedWindowsGUIItems.RemoveAt(index);
                    OpenedWindows.RemoveAt(index);
                }
            }
            foreach (long l in WindowsToOpen)
            {
                OpenedWindows.Add(l);
                OpenedWindowsGUIItems.Add(fact(new WinHandle(l)));
            }
            busy = false;
        }
        private string GetTitle()
        {
            var sb = new StringBuilder(200);

            WINAPI.GetWindowText(Ptr, sb, sb.Capacity);
            return(sb.ToString());
        }
 public void MaximizeMinimize()
 {
     if (!WINAPI.IsIconic(Ptr))
     {
         WINAPI.CloseWindow(Ptr);
     }
     else
     {
         WINAPI.ShowWindow(Ptr, 4);
         WINAPI.SetForegroundWindow(Ptr);
     }
 }
 private bool IsTaskBarWindow(IntPtr hwnd)
 {
     // TODO make sure it won't pass itself
     if (WINAPI.GetWindowTextLength(hwnd) > 0)
     {
         if ((WINAPI.GetWindowLongA(hwnd, WINAPI.GWL_STYLE)) == WINAPI.TARGETWINDOW || WINAPI.IsWindowVisible(hwnd))
         {
             bool bNoOwner = (WINAPI.GetWindow(hwnd, WINAPI.GW_OWNER) == IntPtr.Zero);
             int  lExStyle = WINAPI.GetWindowLong(hwnd, WINAPI.GWL_EXSTYLE);
             if (!bNoOwner)
             {
                 return(false);
             }
             if ((((lExStyle & WINAPI.WS_EX_TOOLWINDOW) == 0)))
             {
                 return(true);
             }
         }
     }
     return(false);
 }
 public void HideWindow()
 {
     WINAPI.MoveWindow(Ptr, 0, -50, 0, 0, false);
 }