Esempio n. 1
0
        public static AllWindowsLayout GetCurrentLayout()
        {
            AllWindowsLayout output = new();

            EnumWindows(delegate(IntPtr hWnd, int lParam)
            {
                if (!IsWindowVisible(hWnd))
                {
                    return(true);
                }

                string windowTitle = WindowHooks.GetWindowTitle(hWnd);
                if (windowTitle is null or "")
                {
                    return(true);
                }

                output.WindowPositions[hWnd] = new WindowLayout {
                    Position = WindowHooks.GetWindowRect(hWnd), WindowToPrecede = WindowHooks.GetNextWindow(hWnd)
                };

                return(true);
            }, 0);
            return(output);
        }
Esempio n. 2
0
 public static void SetCurrentLayout(AllWindowsLayout newLayout)
 {
     foreach (var kvp in newLayout.WindowPositions)
     {
         WindowHooks.SetWindowLayout(kvp.Key, kvp.Value.Position, kvp.Value.WindowToPrecede);
     }
     WindowHooks.WindowArrangementManuallyChanged();
 }