public static void MoveToDesktop(IntPtr handle, VirtualDesktop virtualDesktop)
        {
            ThrowIfNotSupported();

            var guid = virtualDesktop.Id;
            VirtualDesktop.ComManager.MoveWindowToDesktop(handle, ref guid);
        }
        public static bool MoveToDesktop(IntPtr hWnd, VirtualDesktop virtualDesktop)
        {
            ThrowIfNotSupported();

            int processId;
            NativeMethods.GetWindowThreadProcessId(hWnd, out processId);

            if (Process.GetCurrentProcess().Id == processId)
            {
                var guid = virtualDesktop.Id;
                VirtualDesktop.ComManager.MoveWindowToDesktop(hWnd, ref guid);
                return true;
            }

            return false;
        }
        public static void MoveToDesktop(IntPtr hWnd, VirtualDesktop virtualDesktop)
        {
            ThrowIfNotSupported();

            int processId;
            NativeMethods.GetWindowThreadProcessId(hWnd, out processId);

            if (Process.GetCurrentProcess().Id == processId)
            {
                var guid = virtualDesktop.Id;
                ComObjects.VirtualDesktopManager.MoveWindowToDesktop(hWnd, ref guid);
            }
            else
            {
                IApplicationView view;
                ComObjects.ApplicationViewCollection.GetViewForHwnd(hWnd, out view);
                ComObjects.VirtualDesktopManagerInternal.MoveViewToDesktop(view, virtualDesktop.ComObject);
            }
        }
Ejemplo n.º 4
0
 private void btnRightDesktop_Click(object sender, EventArgs e)
 {
     if (fPinState)
     {
         VirtualDesktop.UnpinWindow(this.Handle);
     }
     WindowsDesktop.VirtualDesktop current = this.GetCurrentDesktop();
     if (current != null)
     {
         WindowsDesktop.VirtualDesktop vd = current.GetRight();
         if (vd != null)
         {
             vd.Switch();
         }
     }
     else
     {
     }
     if (fPinState)
     {
         VirtualDesktop.PinWindow(this.Handle);
     }
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Remove the virtual desktop, specifying a virtual desktop that display after destroyed.
        /// </summary>
        public void Remove(VirtualDesktop fallbackDesktop)
        {
            if (fallbackDesktop == null) throw new ArgumentNullException(nameof(fallbackDesktop));

            ComInternal.RemoveDesktop(this.ComObject, fallbackDesktop.ComObject);
        }
 public VirtualDesktopDestroyEventArgs(VirtualDesktop destroyed, VirtualDesktop fallback)
 {
     this.Destroyed = destroyed;
     this.Fallback = fallback;
 }
 public static void MoveToDesktop(this Window window, VirtualDesktop virtualDesktop)
 {
     VirtualDesktopHelper.MoveToDesktop(window.GetHandle(), virtualDesktop);
 }
 public VirtualDesktopChangedEventArgs(VirtualDesktop oldDesktop, VirtualDesktop newDesktop)
 {
     this.OldDesktop = oldDesktop;
     this.NewDesktop = newDesktop;
 }
Ejemplo n.º 9
0
 public static void MoveToDesktop(this Form form, VirtualDesktop virtualDesktop)
 {
     VirtualDesktopHelper.MoveToDesktop(form.Handle, virtualDesktop);
 }
 public VirtualDesktopChangedEventArgs(VirtualDesktop oldDesktop, VirtualDesktop newDesktop)
 {
     this.OldDesktop = oldDesktop;
     this.NewDesktop = newDesktop;
 }
 public static bool IsPinned(this Application app)
 {
     return(VirtualDesktop.IsPinnedApplication(ApplicationHelper.GetAppId(app.GetWindowHandle())));
 }
 public static void Unpin(this Application app)
 {
     VirtualDesktop.UnpinApplication(ApplicationHelper.GetAppId(app.GetWindowHandle()));
 }