From b27f8cb91f814e29a83c08c848fff1809efccc60 Mon Sep 17 00:00:00 2001 From: Marcus Lum Date: Sat, 17 Aug 2019 16:04:56 -0600 Subject: [PATCH] Update VirtualDesktop library to support newer Windows 10 versions --- FreeVD/App/Window.cs | 8 ++++---- FreeVD/FreeVD.csproj | 2 +- VirtualDesktop | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/FreeVD/App/Window.cs b/FreeVD/App/Window.cs index 1cacd99..25e3973 100644 --- a/FreeVD/App/Window.cs +++ b/FreeVD/App/Window.cs @@ -5,7 +5,6 @@ using System.Linq; using System.Text; using WindowsDesktop; -using WindowsDesktop.Interop; namespace FreeVD { @@ -15,7 +14,7 @@ public static IEnumerable GetOpenWindows() { IntPtr shellWindow = User32.GetShellWindow(); var windows = new List(); - User32.EnumWindows((handle,lParam) => + User32.EnumWindows((handle, lParam) => { if (handle != shellWindow && User32.IsWindowVisible(handle) && @@ -59,12 +58,13 @@ public int DesktopNumber try { if (GetProcess().Id != Process.GetCurrentProcess().Id && - ComObjects.GetVirtualDesktopManager().GetWindowDesktopId(Handle) != Guid.Empty) + (VirtualDesktop.FromHwnd(Handle) != null || IsPinnedWindow)) + //ComObjects.GetVirtualDesktopManager().GetWindowDesktopId(Handle) != Guid.Empty) { return (IsPinnedWindow ? VirtualDesktop.Current : VirtualDesktop.FromHwnd(Handle)).GetNumber(); } } - catch (Exception ex) when (ex.HResult == Consts.TYPE_E_ELEMENTNOTFOUND) {} + catch (Exception ex) when (ex.HResult == Consts.TYPE_E_ELEMENTNOTFOUND) { } catch (Exception ex) { Log.LogEvent("Window", $"Handle: {Handle}\nCaption: {GetWindowText()}", ex); diff --git a/FreeVD/FreeVD.csproj b/FreeVD/FreeVD.csproj index c17ecc7..b084155 100644 --- a/FreeVD/FreeVD.csproj +++ b/FreeVD/FreeVD.csproj @@ -86,7 +86,7 @@ - ..\..\..\..\..\..\Program Files (x86)\Windows Kits\8.1\References\CommonConfiguration\Neutral\Windows.winmd + ..\..\..\..\..\..\..\Program Files (x86)\Windows Kits\8.1\References\CommonConfiguration\Neutral\Annotated\Windows.winmd diff --git a/VirtualDesktop b/VirtualDesktop index 4211ae6..dfcd8f6 160000 --- a/VirtualDesktop +++ b/VirtualDesktop @@ -1 +1 @@ -Subproject commit 4211ae6d5b34f351198869ef0a551b5e59416220 +Subproject commit dfcd8f620e183a7d48d2292245bf6e268c7960d5