public override Task <BoolResult> IsHWndOnDesktop(WindowHandle request, ServerCallContext context)
        {
            var hWnd = new IntPtr(request.HWnd);

            Logger.Debug(() => $"Received request: IsHWndOnDesktop({ hWnd.ToHexString() })");

            var result = VirtualDesktopHelper.IsCurrentVirtualDesktop(hWnd);

            return(Task.FromResult(new BoolResult {
                Result = result
            }));
        }
Beispiel #2
0
 /// <summary>
 /// Allow the GridSetters to be hidden or restore when changing virtual desktop.
 /// </summary>
 private static void ManageGridSetters()
 {
     foreach (Process process in Process.GetProcesses())
     {
         if (process.ProcessName.ToLower().StartsWith("gridsetter"))
         {
             var windowHandle = process.MainWindowHandle;
             if (VirtualDesktopHelper.IsCurrentVirtualDesktop(windowHandle))
             {
                 ShowWindow(windowHandle, (int)ShowWindowCommandEnum.Maximize);
             }
             else
             {
                 ShowWindow(windowHandle, (int)ShowWindowCommandEnum.Minimize);
             }
         }
     }
 }
Beispiel #3
0
 /// <summary>
 /// Determines whether the window is located over the virtual desktop that current displayed.
 /// </summary>
 public static bool IsCurrentVirtualDesktop(this Window window)
 {
     return(VirtualDesktopHelper.IsCurrentVirtualDesktop(window.GetHandle()));
 }