示例#1
0
        public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
        {
            List <KeyValuePair <Pair <VirtualDesktop, HMONITOR>, Layout> > list = new List <KeyValuePair <Pair <VirtualDesktop, HMONITOR>, Layout> >();

            JArray array = JArray.Load(reader);

            VirtualDesktop virtualDesktop = null;
            HMONITOR       hMONITOR       = HMONITOR.NULL;
            Layout         layout         = Layout.Tall;

            foreach (JObject desktopMonitor in array.Children())
            {
                var      properties = desktopMonitor.Properties().ToList();
                Point    point      = new Point(properties[1].Value.ToObject <int>() + 100, properties[2].Value.ToObject <int>() + 100);
                HMONITOR monitor    = User32.MonitorFromPoint(point, User32.MonitorFlags.MONITOR_DEFAULTTONEAREST);

                virtualDesktop = VirtualDesktop.FromIndex(VirtualDesktop.SearchDesktop(properties[0].Value.ToString()));
                hMONITOR       = monitor;
                layout         = (Layout)properties[3].Value.ToObject <int>();
            }

            var key = new Pair <VirtualDesktop, HMONITOR>(virtualDesktop, hMONITOR);

            list.Add(new KeyValuePair <Pair <VirtualDesktop, HMONITOR>, Layout>(key, layout));

            return(list);
        }
示例#2
0
 /// <summary>
 /// Creates a new instance of <see cref="Output"/>
 /// </summary>
 public Output(ComPtr <IDXGIOutput> output, string deviceName, Rectangle desktopCoordinates, bool attachedToDesktop, DXGI_MODE_ROTATION rotation, HMONITOR monitor)
 {
     _output            = output;
     DeviceName         = deviceName;
     DesktopCoordinates = desktopCoordinates;
     AttachedToDesktop  = attachedToDesktop;
     Rotation           = rotation;
     Monitor            = monitor;
 }
        public void RotateMonitorCounterClockwise(Pair <VirtualDesktop, HMONITOR> currentDesktopMonitor)
        {
            List <HMONITOR> virtualDesktopMonitors = Windows
                                                     .Keys
                                                     .Where(desktopMonitor => desktopMonitor.Item1.Equals(currentDesktopMonitor.Item1))
                                                     .Select(desktopMonitor => desktopMonitor.Item2)
                                                     .ToList();

            HMONITOR nextMonitor = virtualDesktopMonitors.TakeWhile(x => x != currentDesktopMonitor.Item2).Skip(1).DefaultIfEmpty(virtualDesktopMonitors[0]).FirstOrDefault();
            Pair <VirtualDesktop, HMONITOR> nextDesktopMonitor = new Pair <VirtualDesktop, HMONITOR>(currentDesktopMonitor.Item1, nextMonitor);

            User32.SetForegroundWindow(Windows[nextDesktopMonitor].FirstOrDefault().Window);
        }
        private void DrawMonitor(KeyValuePair <Pair <VirtualDesktop, HMONITOR>, ObservableCollection <DesktopWindow> > desktopMonitor, out float ScreenScalingFactorVert, out int mX, out int mY, out IEnumerable <Rectangle> gridGenerator)
        {
            HMONITOR m            = desktopMonitor.Key.Item2;
            int      windowsCount = desktopMonitor.Value.Count();

            User32.MONITORINFOEX info = new User32.MONITORINFOEX();
            info.cbSize = (uint)Marshal.SizeOf(info);
            User32.GetMonitorInfo(m, ref info);

            Gdi32.SafeHDC hdc = Gdi32.CreateDC(info.szDevice);
            int           LogicalScreenHeight  = Gdi32.GetDeviceCaps(hdc, Gdi32.DeviceCap.VERTRES);
            int           PhysicalScreenHeight = Gdi32.GetDeviceCaps(hdc, Gdi32.DeviceCap.DESKTOPVERTRES);
            int           LogicalScreenWidth   = Gdi32.GetDeviceCaps(hdc, Gdi32.DeviceCap.HORZRES);
            int           PhysicalScreenWidth  = Gdi32.GetDeviceCaps(hdc, Gdi32.DeviceCap.DESKTOPHORZRES);

            hdc.Close();

            float ScreenScalingFactorHoriz = (float)PhysicalScreenWidth / (float)LogicalScreenWidth;

            ScreenScalingFactorVert = (float)PhysicalScreenHeight / (float)LogicalScreenHeight;
            mX = info.rcWork.X + MarginLeft;
            mY = info.rcWork.Y + MarginTop;
            int mWidth  = info.rcWork.Width - MarginLeft - MarginRight;
            int mHeight = info.rcWork.Height - MarginTop - MarginBottom;

            Layout mCurrentLayout;

            try
            {
                mCurrentLayout = Layouts[desktopMonitor.Key];
            }
            catch
            {
                Layouts.Add(desktopMonitor.Key, Layout.Tall);
                mCurrentLayout = Layouts[desktopMonitor.Key];
            }

            if (!Factors.ContainsKey(desktopMonitor.Key))
            {
                Factors[desktopMonitor.Key] = 0;
            }

            gridGenerator = GridGenerator(mWidth, mHeight, windowsCount, Factors[desktopMonitor.Key], mCurrentLayout, LayoutPadding);
        }
示例#5
0
 public DesktopWindow GetWindowByHandlers(HWND hWND, HMONITOR hMONITOR, VirtualDesktop desktop)
 {
     return(Windows[new Pair <VirtualDesktop, HMONITOR>(desktop, hMONITOR)].FirstOrDefault(window => window.Window == hWND));
 }
示例#6
0
        public void setWindowsHook()
        {
            void WinEventHookAll(User32.HWINEVENTHOOK hWinEventHook, uint winEvent, HWND hwnd, int idObject, int idChild, uint idEventThread, uint dwmsEventTime)
            {
                DesktopWindow desktopWindow = new DesktopWindow(hwnd);

                if (hwnd != HWND.NULL && idObject == User32.ObjectIdentifiers.OBJID_WINDOW && idChild == 0 && desktopWindow.IsRuntimeValuable())
                {
                    switch (winEvent)
                    {
                    case User32.EventConstants.EVENT_OBJECT_SHOW:
                    case User32.EventConstants.EVENT_OBJECT_UNCLOAKED:
                    case User32.EventConstants.EVENT_OBJECT_IME_SHOW:
                    case User32.EventConstants.EVENT_SYSTEM_FOREGROUND:
                        ManageShown(hwnd);
                        break;

                    case User32.EventConstants.EVENT_SYSTEM_MINIMIZEEND:
                        SystrayContext.Logger.Information($"window maximized");
                        desktopWindow.GetInfo();
                        DesktopWindowsManager.AddWindow(desktopWindow);
                        break;

                    case User32.EventConstants.EVENT_SYSTEM_MINIMIZESTART:
                    case User32.EventConstants.EVENT_OBJECT_HIDE:
                    case User32.EventConstants.EVENT_OBJECT_IME_HIDE:
                        SystrayContext.Logger.Information($"window minimized/hide");
                        HMONITOR      monitorHandle = User32.MonitorFromWindow(hwnd, User32.MonitorFlags.MONITOR_DEFAULTTONEAREST);
                        DesktopWindow remove        = DesktopWindowsManager.GetWindowByHandlers(hwnd, monitorHandle, VirtualDesktop.Current);
                        if (remove != null)
                        {
                            DesktopWindowsManager.RemoveWindow(remove);
                        }
                        break;

                    case User32.EventConstants.EVENT_SYSTEM_MOVESIZEEND:
                        SystrayContext.Logger.Information($"window move/size");

                        DesktopWindow  movedWindow1                = DesktopWindowsManager.FindWindow(hwnd);
                        VirtualDesktop movedDesktop1               = VirtualDesktop.FromHwnd(hwnd);
                        HMONITOR       currentMonitor1             = User32.MonitorFromWindow(hwnd, User32.MonitorFlags.MONITOR_DEFAULTTONEAREST);
                        Pair <VirtualDesktop, HMONITOR> movedPair1 = new Pair <VirtualDesktop, HMONITOR>(movedDesktop1, currentMonitor1);

                        DesktopWindow resizedWindow = new DesktopWindow(hwnd);
                        resizedWindow.GetInfo();
                        if (resizedWindow.Info.rcWindow.Size.Equals(movedWindow1.Info.rcWindow.Size))
                        {
                            // Not resized.
                            DesktopWindow  movedWindow2                = DesktopWindowsManager.FindWindow(Control.MousePosition);
                            VirtualDesktop movedDesktop2               = VirtualDesktop.FromHwnd(movedWindow2.Window);
                            HMONITOR       currentMonitor2             = User32.MonitorFromWindow(movedWindow2.Window, User32.MonitorFlags.MONITOR_DEFAULTTONEAREST);
                            Pair <VirtualDesktop, HMONITOR> movedPair2 = new Pair <VirtualDesktop, HMONITOR>(movedDesktop2, currentMonitor2);
                            DesktopWindowsManager.SwapWindows(movedPair1, movedWindow1, movedPair2, movedWindow2);
                            DesktopWindowsManager.Draw(movedPair2);
                        }
                        else
                        {
                            // Resized.
                        }
                        DesktopWindowsManager.Draw(movedPair1);
                        break;

                    default:
                        break;
                    }
                }
            }

            User32.WinEventProc winEventHookAll = new User32.WinEventProc(WinEventHookAll);
            GCHandle            gchCreate       = GCHandle.Alloc(winEventHookAll);

            User32.HWINEVENTHOOK hookAll = User32.SetWinEventHook(User32.EventConstants.EVENT_MIN, User32.EventConstants.EVENT_MAX, HINSTANCE.NULL, winEventHookAll, 0, 0, User32.WINEVENT.WINEVENT_OUTOFCONTEXT | User32.WINEVENT.WINEVENT_SKIPOWNPROCESS);
        }
示例#7
0
 public static extern HRESULT GetDpiForMonitor(HMONITOR hmonitor, MONITOR_DPI_TYPE dpiType, out uint dpiX, out uint dpiY);
示例#8
0
 public static extern HRESULT GetScaleFactorForMonitor(HMONITOR hMon, out DEVICE_SCALE_FACTOR pScale);
示例#9
0
 internal static extern uint GetDpiForMonitor(HMONITOR hmonitor, MONITOR_DPI_TYPE dpiType, out uint dpiX, out uint dpiY);
示例#10
0
        static void Main(string[] args)
        {
            //==============================================================
            // GET PHYSICAL MONITORS TO ACQUIRE DISPLAY DATA CHANNEL (DDC)
            //==============================================================
            const string msgCaption = "DDCCI.Framework.cs";

            /*
             *  UNLIKE C++ PROJECT, Screen class from System.Windows.Forms has a private "hmonitor" field
             *  that contains the HMONITOR exactly what this project needs. However, since the field is not
             *  accessible publicly, the code below get the field value indirectly from the instance.
             */
            FieldInfo hmonitorField = typeof(Screen).GetField("hmonitor", BindingFlags.NonPublic | BindingFlags.GetField | BindingFlags.Instance);

            foreach (Screen screen in Screen.AllScreens)
            {
                rcHMONITOR.Add((HMONITOR)hmonitorField.GetValue(screen));
            }

            /*
             *  FIRST, GET the number of physical monitors associated to the HMONITOR. The number of the associated physical monitor
             *  is passed to the "rcNumberOfPhysicalMonitors" list corresponding to the HMONITOR order.
             */
            foreach (HMONITOR hMon in rcHMONITOR)
            {
                DWORD _rcNumberOfPhysicalMonitors = 0;
                if (!Dxva2.GetNumberOfPhysicalMonitorsFromHMONITOR(hMon, ref _rcNumberOfPhysicalMonitors))
                {
                    MessageBox.Show("Unable to retrieve the number of physical monitors.", msgCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                rcNumberOfPhysicalMonitors.Add(_rcNumberOfPhysicalMonitors);
            }

            /*
             *  SECOND, ACQUIRE the array of physical monitor information associated to the HMONITOR.
             *  Each element of the "rcNumberOfPhysicalMonitors" list acts as an array of the
             *  corresponding HMONITOR containing the "rcNumberOfPhysicalMonitors" number of physical
             *  monitor information.
             */
            for (int index = 0; index < rcHMONITOR.Count; index++)
            {
                Dxva2.PHYSICAL_MONITOR[] _rcArrayOfPhysicalMonitors = new Dxva2.PHYSICAL_MONITOR[rcNumberOfPhysicalMonitors[index]];
                if (!Dxva2.GetPhysicalMonitorsFromHMONITOR(rcHMONITOR[index], rcNumberOfPhysicalMonitors[index], ref _rcArrayOfPhysicalMonitors[0]))
                {
                    MessageBox.Show("Unable to retrieve the physical monitors.", msgCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                rcArrayOfPhysicalMonitors.Add(_rcArrayOfPhysicalMonitors);
            }

            //==============================================================
            // MANIPULATE THE MONITOR VIA DDC/CI
            //==============================================================
            for (int index = 0; index < rcHMONITOR.Count; index++)
            {
                for (int nMonitor = 0; nMonitor < rcNumberOfPhysicalMonitors[index]; nMonitor++)
                {
                    Console.WriteLine(string.Format("[{0}] {1} x {2}\t({3}, {4})",
                                                    (int)rcArrayOfPhysicalMonitors[index][nMonitor].hPhysicalMonitor, Screen.AllScreens[index].Bounds.Width, Screen.AllScreens[index].Bounds.Height,
                                                    Screen.AllScreens[index].Bounds.Left, Screen.AllScreens[index].Bounds.Top)
                                      );
                }
            }
            Console.WriteLine("--------------------------------");

            /*
             *  SELECT THE MONITOR to communicate DDC/CI.
             *  Beware, this may not be available for a television which is kinda bit different from a monitor.
             */
            int      nSelect;
            HMONITOR hMonitor = INVALID_HANDLE_VALUE;

            while (true)
            {
                Console.Write("Select the monitor to communicate DDC/CI: ");
                nSelect = Convert.ToInt32(Console.ReadLine());
                for (int index = 0; index < rcHMONITOR.Count; index++)
                {
                    for (int nMonitor = 0; nMonitor < rcNumberOfPhysicalMonitors[index]; nMonitor++)
                    {
                        if ((int)rcArrayOfPhysicalMonitors[index][nMonitor].hPhysicalMonitor == nSelect)
                        {
                            hMonitor = rcArrayOfPhysicalMonitors[index][nMonitor].hPhysicalMonitor;
                            break;
                        }
                    }
                    if (hMonitor != INVALID_HANDLE_VALUE)
                    {
                        break;
                    }
                }
                if (hMonitor != INVALID_HANDLE_VALUE)
                {
                    break;
                }
            }

            cmdInterface cmdSelect;

            while (true)
            {
                Console.Write("\n 1. GET\n 2. SET\n 0. EXIT\nSelect the configuration option: ");
                try { cmdSelect = (cmdInterface)Convert.ToInt32(Console.ReadLine()); }
                catch (Exception) { continue; }

                if ((int)cmdSelect >= (int)cmdInterface.MAX_COUNT)
                {
                    continue;
                }
                else if (cmdSelect == cmdInterface.EXIT)
                {
                    break;
                }

                /*
                 *  CONVERTS TWO-DIGIT hexadecimal string vcp code to numerical BYTE which ranges from 0 ~ 255.
                 *  The format of the hexadecimal must be "0x00", otherwise cannot be recognized by the program.
                 */
                string vcp; byte opcode;
                Console.Write(" - Enter the VCP code for DDC/CI: ");
                vcp = Console.ReadLine();
                if ((vcp.Contains("0x") || vcp.Contains("0X")) && vcp.Length == 4)
                {
                    opcode = Convert.ToByte(vcp.Substring(2), 16);
                }
                else
                {
                    Console.WriteLine(" [INFO] Please enter the hexadecimal in \"0x00\" format!");
                    continue;
                }

                /*
                 *  DEPENDING ON THE selection, either GET or SET monitor configuration such as Dim.Brightness
                 *  using universal "0x10" VCP code. The input and output values from the DDC/CI are decimal.
                 */
                if (cmdSelect == cmdInterface.GET)
                {
                    DWORD currentValue = 0, maximumValue = 0;
                    if (!Dxva2.GetVCPFeatureAndVCPFeatureReply(hMonitor, opcode, 0, ref currentValue, ref maximumValue))
                    {
                        Console.WriteLine(" [INFO] Failed to get the configuration from the monitor with DDC/CI!");
                    }
                    else
                    {
                        Console.WriteLine(string.Format(" >> {0} [MAX.{1}]", currentValue, maximumValue));
                    }
                }
                else
                {
                    Console.Write(" - Enter the value for the VCP code: ");
                    DWORD setValue = Convert.ToUInt32(Console.ReadLine());
                    if (!Dxva2.SetVCPFeature(hMonitor, opcode, setValue))
                    {
                        Console.WriteLine(" [INFO] Failed to set the configuration from the monitor with DDC/CI!");
                    }
                    else
                    {
                        Console.WriteLine(string.Format(" >> {0} set to {1}", vcp, setValue));
                    }
                }
            }
        }
示例#11
0
 public static extern bool GetMonitorInfo(HMONITOR hMonitor, ref MONITORINFOEX lpmi);
 public HRESULT ChangeDDrawDevice([NativeTypeName("LPDIRECTDRAW7")] IDirectDraw7 *lpDDrawDevice, HMONITOR hMonitor)
 {
     return(((delegate * unmanaged <IVMRSurfaceAllocatorNotify *, IDirectDraw7 *, HMONITOR, int>)(lpVtbl[5]))((IVMRSurfaceAllocatorNotify *)Unsafe.AsPointer(ref this), lpDDrawDevice, hMonitor));
 }
示例#13
0
 public static extern BOOL GetMonitorInfoW(HMONITOR hMonitor, MONITORINFO *lpmi);
示例#14
0
 public HRESULT CreateForMonitor(HMONITOR monitor, [NativeTypeName("const IID &")] Guid *riid, void **result)
 {
     return(((delegate * unmanaged <IGraphicsCaptureItemInterop *, HMONITOR, Guid *, void **, int>)(lpVtbl[4]))((IGraphicsCaptureItemInterop *)Unsafe.AsPointer(ref this), monitor, riid, result));
 }
示例#15
0
 private void Form_AmethystSystrayHotKey(object sender, int e)
 {
     if (e == 0x11) //space bar
     {
         HMONITOR       currentMonitor = User32.MonitorFromPoint(Control.MousePosition, User32.MonitorFlags.MONITOR_DEFAULTTONEAREST);
         VirtualDesktop currentDesktop = VirtualDesktop.Current;
         Pair <VirtualDesktop, HMONITOR> currentPair = new Pair <VirtualDesktop, HMONITOR>(currentDesktop, currentMonitor);
         DWM.RotateLayoutClockwise(currentPair);
         DWM.Draw(currentPair);
         DWM.SaveLayouts();
     }
     if (e == 0x12) //enter
     {
         HWND          selectedWindow = User32.GetForegroundWindow();
         HMONITOR      currentMonitor = User32.MonitorFromWindow(selectedWindow, User32.MonitorFlags.MONITOR_DEFAULTTONEAREST);
         DesktopWindow selected       = DWM.GetWindowByHandlers(selectedWindow, currentMonitor, VirtualDesktop.Current);
         Pair <VirtualDesktop, HMONITOR> currentPair = new Pair <VirtualDesktop, HMONITOR>(VirtualDesktop.Current, currentMonitor);
         DWM.SetMainWindow(currentPair, selected);
         DWM.Draw(currentPair);
     }
     if (e == 0x15) // j
     {
         HWND          selectedWindow = User32.GetForegroundWindow();
         HMONITOR      currentMonitor = User32.MonitorFromWindow(selectedWindow, User32.MonitorFlags.MONITOR_DEFAULTTONEAREST);
         DesktopWindow selected       = DWM.GetWindowByHandlers(selectedWindow, currentMonitor, VirtualDesktop.Current);
         Pair <VirtualDesktop, HMONITOR> currentPair = new Pair <VirtualDesktop, HMONITOR>(VirtualDesktop.Current, currentMonitor);
         DWM.RotateFocusedWindowClockwise(currentPair, selected);
         DWM.Draw(currentPair);
     }
     if (e == 0x14) // k
     {
         HWND          selectedWindow = User32.GetForegroundWindow();
         HMONITOR      currentMonitor = User32.MonitorFromWindow(selectedWindow, User32.MonitorFlags.MONITOR_DEFAULTTONEAREST);
         DesktopWindow selected       = DWM.GetWindowByHandlers(selectedWindow, currentMonitor, VirtualDesktop.Current);
         Pair <VirtualDesktop, HMONITOR> currentPair = new Pair <VirtualDesktop, HMONITOR>(VirtualDesktop.Current, currentMonitor);
         DWM.RotateFocusedWindowCounterClockwise(currentPair, selected);
         DWM.Draw(currentPair);
     }
     if (e == 0x13) // l
     {
         HWND          selectedWindow = User32.GetForegroundWindow();
         HMONITOR      currentMonitor = User32.MonitorFromWindow(selectedWindow, User32.MonitorFlags.MONITOR_DEFAULTTONEAREST);
         DesktopWindow selected       = DWM.GetWindowByHandlers(selectedWindow, currentMonitor, VirtualDesktop.Current);
         Pair <VirtualDesktop, HMONITOR> currentPair = new Pair <VirtualDesktop, HMONITOR>(VirtualDesktop.Current, currentMonitor);
         DWM.MoveWindowClockwise(currentPair, selected);
         DWM.Draw(currentPair);
     }
     if (e == 0x16) //h
     {
         HWND          selectedWindow = User32.GetForegroundWindow();
         HMONITOR      currentMonitor = User32.MonitorFromWindow(selectedWindow, User32.MonitorFlags.MONITOR_DEFAULTTONEAREST);
         DesktopWindow selected       = DWM.GetWindowByHandlers(selectedWindow, currentMonitor, VirtualDesktop.Current);
         Pair <VirtualDesktop, HMONITOR> currentPair = new Pair <VirtualDesktop, HMONITOR>(VirtualDesktop.Current, currentMonitor);
         DWM.MoveWindowCounterClockwise(currentPair, selected);
         DWM.Draw(currentPair);
     }
     if (e == 0x17) //z
     {
         DWM.ClearWindows();
         DWM.GetWindows();
         DWM.Draw();
     }
     if (e == 0x21) //space bar
     {
         HMONITOR       currentMonitor = User32.MonitorFromPoint(Control.MousePosition, User32.MonitorFlags.MONITOR_DEFAULTTONEAREST);
         VirtualDesktop currentDesktop = VirtualDesktop.Current;
         Pair <VirtualDesktop, HMONITOR> currentPair = new Pair <VirtualDesktop, HMONITOR>(currentDesktop, currentMonitor);
         DWM.RotateLayoutCounterClockwise(currentPair);
         DWM.Draw(currentPair);
         DWM.SaveLayouts();
     }
     if (e == 0x22) //h
     {
         debounceDispatcher.Debounce(() =>
         {
             HMONITOR currentMonitor = User32.MonitorFromPoint(Control.MousePosition, User32.MonitorFlags.MONITOR_DEFAULTTONEAREST);
             Pair <VirtualDesktop, HMONITOR> currentPair = new Pair <VirtualDesktop, HMONITOR>(VirtualDesktop.Current, currentMonitor);
             DWM.ExpandMainPane(currentPair);
             DWM.Draw(currentPair);
         });
     }
     if (e == 0x23) //l
     {
         debounceDispatcher.Debounce(() =>
         {
             HMONITOR currentMonitor = User32.MonitorFromPoint(Control.MousePosition, User32.MonitorFlags.MONITOR_DEFAULTTONEAREST);
             Pair <VirtualDesktop, HMONITOR> currentPair = new Pair <VirtualDesktop, HMONITOR>(VirtualDesktop.Current, currentMonitor);
             DWM.ShrinkMainPane(currentPair);
             DWM.Draw(currentPair);
         });
     }
     if (e == 0x24) //j
     {
         HWND          selectedWindow = User32.GetForegroundWindow();
         DesktopWindow selected       = DWM.FindWindow(selectedWindow);
         DWM.MoveWindowPreviousScreen(selected);
         DWM.Draw();
     }
     if (e == 0x25) //k
     {
         HWND          selectedWindow = User32.GetForegroundWindow();
         DesktopWindow selected       = DWM.FindWindow(selectedWindow);
         DWM.MoveWindowNextScreen(selected);
         DWM.Draw();
     }
     if (e == 0x21) //l
     {
         HMONITOR       currentMonitor = User32.MonitorFromPoint(Control.MousePosition, User32.MonitorFlags.MONITOR_DEFAULTTONEAREST);
         VirtualDesktop currentDesktop = VirtualDesktop.Current;
         Pair <VirtualDesktop, HMONITOR> currentPair = new Pair <VirtualDesktop, HMONITOR>(currentDesktop, currentMonitor);
         DWM.RotateLayoutCounterClockwise(currentPair);
         DWM.Draw(currentPair);
         DWM.SaveLayouts();
     }
     if (e == 0x26) //right
     {
         debounceDispatcher.Debounce(() =>
         {
             HWND selectedWindow    = User32.GetForegroundWindow();
             DesktopWindow selected = DWM.FindWindow(selectedWindow);
             DWM.MoveWindowNextVirtualDesktop(selected);
             DWM.Draw();
         });
     }
     if (e == 0x27) //right
     {
         debounceDispatcher.Debounce(() =>
         {
             HWND selectedWindow    = User32.GetForegroundWindow();
             DesktopWindow selected = DWM.FindWindow(selectedWindow);
             DWM.MoveWindowPreviousVirtualDesktop(selected);
             DWM.Draw();
         });
     }
     if (e == 0x1 || e == 0x2 || e == 0x3 || e == 0x4 || e == 0x5) //1,2,3,4,5
     {
         debounceDispatcher.Debounce(() =>
         {
             HWND selectedWindow    = User32.GetForegroundWindow();
             DesktopWindow selected = DWM.FindWindow(selectedWindow);
             DWM.MoveWindowSpecificVirtualDesktop(selected, e - 1);
             DWM.Draw();
         });
     }
 }
示例#16
0
 public HRESULT GetAppVisibilityOnMonitor(HMONITOR hMonitor, MONITOR_APP_VISIBILITY *pMode)
 {
     return(((delegate * unmanaged <IAppVisibility *, HMONITOR, MONITOR_APP_VISIBILITY *, int>)(lpVtbl[3]))((IAppVisibility *)Unsafe.AsPointer(ref this), hMonitor, pMode));
 }
 public HRESULT ShowResolveConflictUIAsync([NativeTypeName("LPCWSTR")] ushort *localFilePath, HMONITOR monitorToDisplayOn)
 {
     return(((delegate * unmanaged <IFileSyncMergeHandler *, ushort *, HMONITOR, int>)(lpVtbl[4]))((IFileSyncMergeHandler *)Unsafe.AsPointer(ref this), localFilePath, monitorToDisplayOn));
 }
示例#18
0
 public HRESULT CreateMonitorRenderingParams(HMONITOR monitor, IDWriteRenderingParams **renderingParams)
 {
     return(((delegate * unmanaged <IDWriteFactory1 *, HMONITOR, IDWriteRenderingParams **, int>)(lpVtbl[11]))((IDWriteFactory1 *)Unsafe.AsPointer(ref this), monitor, renderingParams));
 }
示例#19
0
 public HRESULT DockWindow(HWND hwnd, HMONITOR hMonitor, uint cyRequested, IAccessibilityDockingServiceCallback *pCallback)
 {
     return(((delegate * unmanaged <IAccessibilityDockingService *, HWND, HMONITOR, uint, IAccessibilityDockingServiceCallback *, int>)(lpVtbl[4]))((IAccessibilityDockingService *)Unsafe.AsPointer(ref this), hwnd, hMonitor, cyRequested, pCallback));
 }
示例#20
0
 public MonitorHandle(HMONITOR hmonitor) => HMONITOR = hmonitor;
示例#21
0
 internal static extern bool GetNumberOfPhysicalMonitorsFromHMONITOR(HMONITOR hMonitor, ref DWORD pdwNumberOfPhysicalMonitors);
 public HRESULT OnDisplayChange(HMONITOR hMonitor)
 {
     return(((delegate * unmanaged <IOverlayNotify2 *, HMONITOR, int>)(lpVtbl[7]))((IOverlayNotify2 *)Unsafe.AsPointer(ref this), hMonitor));
 }
示例#23
0
 internal static extern bool GetPhysicalMonitorsFromHMONITOR(HMONITOR hMonitor, DWORD dwPhysicalMonitorArraySize, ref PHYSICAL_MONITOR pPhysicalMonitorArray);
示例#24
0
 public HRESULT AppVisibilityOnMonitorChanged(HMONITOR hMonitor, MONITOR_APP_VISIBILITY previousMode, MONITOR_APP_VISIBILITY currentMode)
 {
     return(((delegate * unmanaged <IAppVisibilityEvents *, HMONITOR, MONITOR_APP_VISIBILITY, MONITOR_APP_VISIBILITY, int>)(lpVtbl[3]))((IAppVisibilityEvents *)Unsafe.AsPointer(ref this), hMonitor, previousMode, currentMode));
 }
示例#25
0
 public HRESULT GetAvailableSize(HMONITOR hMonitor, uint *pcxFixed, uint *pcyMax)
 {
     return(((delegate * unmanaged <IAccessibilityDockingService *, HMONITOR, uint *, uint *, int>)(lpVtbl[3]))((IAccessibilityDockingService *)Unsafe.AsPointer(ref this), hMonitor, pcxFixed, pcyMax));
 }