public static VirtualDesktop MoveToRight(this IntPtr hWnd, IVdmHelper helper) { var current = VirtualDesktop.FromHwnd(hWnd); if (current != null) { var right = current.GetRight(); if (right == null) { if (Settings.General.LoopDesktop) { var desktops = VirtualDesktop.GetDesktops(); if (desktops.Length >= 2) { right = desktops.First(); } } } if (right != null) { if (VirtualDesktopHelper.MoveToDesktop(hWnd, right) || helper.MoveWindowToDesktop(hWnd, right.Id)) { return(right); } } } SystemSounds.Asterisk.Play(); return(null); }
public static VirtualDesktop MoveToNew(this IntPtr hWnd, IVdmHelper helper) { var newone = VirtualDesktop.Create(); if (newone != null) { if (VirtualDesktopHelper.MoveToDesktop(hWnd, newone) || helper.MoveWindowToDesktop(hWnd, newone.Id)) { return(newone); } } SystemSounds.Asterisk.Play(); return(null); }
private void MoveWindow(IntPtr hwnd, int index) { if (hwnd != IntPtr.Zero) { for (int i = 0; i < activeWindows.Length; ++i) { if (activeWindows[i] == hwnd) { activeWindows[i] = IntPtr.Zero; } } movingWindow = hwnd; Debug.WriteLine("Move " + hwnd + " from " + Current + " to " + index); if (!VirtualDesktopHelper.MoveToDesktop(hwnd, desktops[index])) { VDMHelper.MoveWindowToDesktop(hwnd, desktops[index].Id); } } }