public static void MinimizeAllOpenWindows(bool force = false)
 {
     if (force)
     {
         SEBWindowHandler.SendMessage(SEBWindowHandler.FindWindow("Shell_TrayWnd", (string)null), 273, (IntPtr)419, IntPtr.Zero);
     }
     else
     {
         SEBWindowHandler.EditAllOpenWindows(SEBWindowHandler.ShowWindowCommand.SW_SHOWMINIMIZED);
     }
 }
 private static void EditWindowByHandle(IntPtr windowHandle, SEBWindowHandler.ShowWindowCommand action, bool waitForShowingUp = false)
 {
     if (action == SEBWindowHandler.ShowWindowCommand.SW_HIDE)
     {
         SEBWindowHandler._hiddenWindowHandles.Add(windowHandle);
     }
     ThreadPool.QueueUserWorkItem((WaitCallback)(_param1 =>
     {
         try
         {
             if (action == SEBWindowHandler.ShowWindowCommand.SW_SHOWMINIMIZED & waitForShowingUp)
             {
                 Thread.Sleep(500);
             }
             if (!SEBWindowHandler.ShowWindowAsync(windowHandle, (int)action))
             {
                 if (action == SEBWindowHandler.ShowWindowCommand.SW_SHOWMINIMIZED)
                 {
                     SEBWindowHandler.SendMessage(windowHandle, 274, (IntPtr)61472, IntPtr.Zero);
                     Logger.AddInformation(string.Format("Window {0} minimized", (object)windowHandle.GetWindowTitle()), (object)null, (Exception)null, (string)null);
                 }
                 else if (action == SEBWindowHandler.ShowWindowCommand.SW_HIDE)
                 {
                     SEBWindowHandler.SendMessage(windowHandle, 274, (IntPtr)61536, IntPtr.Zero);
                     Logger.AddInformation(string.Format("Window {0} closed, because i was unable to hide it", (object)windowHandle.GetWindowTitle()), (object)null, (Exception)null, (string)null);
                 }
                 else
                 {
                     if (action != SEBWindowHandler.ShowWindowCommand.SW_SHOWMAXIMIZED)
                     {
                         return;
                     }
                     SEBWindowHandler.SendMessage(windowHandle, 274, (IntPtr)61488, IntPtr.Zero);
                     Logger.AddInformation(string.Format("Window {0} Maximized", (object)windowHandle.GetWindowTitle()), (object)null, (Exception)null, (string)null);
                 }
             }
             else
             {
                 Logger.AddInformation(string.Format("Window {0} {1}", (object)windowHandle.GetWindowTitle(), (object)action.ToString()), (object)null, (Exception)null, (string)null);
             }
         }
         catch
         {
             try
             {
                 if (action == SEBWindowHandler.ShowWindowCommand.SW_SHOWMINIMIZED)
                 {
                     SEBWindowHandler.SendMessage(windowHandle, 274, (IntPtr)61472, IntPtr.Zero);
                     Logger.AddInformation(string.Format("Window {0} minimized", (object)windowHandle.GetWindowTitle()), (object)null, (Exception)null, (string)null);
                 }
                 else if (action == SEBWindowHandler.ShowWindowCommand.SW_HIDE)
                 {
                     SEBWindowHandler.SendMessage(windowHandle, 274, (IntPtr)61536, IntPtr.Zero);
                     Logger.AddInformation(string.Format("Window {0} closed, because i was unable to hide it", (object)windowHandle.GetWindowTitle()), (object)null, (Exception)null, (string)null);
                 }
                 else
                 {
                     if (action != SEBWindowHandler.ShowWindowCommand.SW_SHOWMAXIMIZED)
                     {
                         return;
                     }
                     SEBWindowHandler.SendMessage(windowHandle, 274, (IntPtr)61488, IntPtr.Zero);
                     Logger.AddInformation(string.Format("Window {0} Maximized", (object)windowHandle.GetWindowTitle()), (object)null, (Exception)null, (string)null);
                 }
             }
             catch (Exception ex)
             {
             }
         }
     }));
 }
 public static void CloseWindow(this IntPtr windowHandle)
 {
     SEBWindowHandler.SendMessage(windowHandle, 16, IntPtr.Zero, IntPtr.Zero);
 }