枚举 Windows 11 个桌面,每个桌面出现 windows
Enumerate Windows 11 desktops and windows appearing in each desktop
我正在使用 Windows 11 并使用 WinKey+TAB 创建了多个桌面。
它们具有非常漂亮的功能,即 ALT+TAB 仅显示给定桌面上的 windows,从而极大地减少了视觉混乱。它还能够在所有桌面上显示选定的 windows。
我认为这些虚拟桌面在 Windows 11 之前也可用。
但是,当我使用 Win32 控制台应用程序枚举桌面时,执行 GetProcessWindowStation() 的简单组合,然后调用 EnumDesktops() 无论我创建了多少个桌面,我总是得到相同的答案。
我得到两个名为:DummyDesktopForInstantResume 和 Default
的桌面
看来 WinKey+Tab 'desktops' 与 EnumDesktops() 'desktops'.
不一样
我用 Spy++ 做了一些额外的挖掘,它只显示一个根桌面,所有 windows 都属于那个桌面。无论 Spy++“出现”在哪个桌面上,它总是显示相同的 window 列表。而且无论应用程序出现在哪个桌面上,它始终具有相同的 window 句柄(正如预期的那样)。
有谁知道Windows11中如何枚举WinKey+TAB创建的虚拟桌面?
谢谢
So it seems that the WinKey+Tab 'desktops' are not the same as the EnumDesktops() 'desktops'.
不,他们不是。它们是用户当前 Win32 桌面中的“虚拟”桌面 运行。虚拟桌面只是一个 window 管理系统,一种让用户将多个 windows 组合在一起然后 hide/show 这些组作为一个整体的方法。 Raymond Chen 对此发表了博文:
Virtual desktops are an end-user window management feature, not a programmatic one
Virtual desktops are a window management feature, not a security feature or a performance feature. Furthermore, they are for end users to organize their windows, not for other programs to organize the windows.
Anyone knows how do we enumerate the virtual desktops created by WinKey+TAB in Windows 11?
不幸的是,没有 public API 可用于枚举这些虚拟桌面(但有一个 that can). The public IVirtualDesktopManager
接口非常有限, 它允许您只查询给定的 window 是否属于当前活动的虚拟桌面,并将 window 移动到特定的虚拟桌面。仅此而已。
我正在使用 Windows 11 并使用 WinKey+TAB 创建了多个桌面。 它们具有非常漂亮的功能,即 ALT+TAB 仅显示给定桌面上的 windows,从而极大地减少了视觉混乱。它还能够在所有桌面上显示选定的 windows。 我认为这些虚拟桌面在 Windows 11 之前也可用。
但是,当我使用 Win32 控制台应用程序枚举桌面时,执行 GetProcessWindowStation() 的简单组合,然后调用 EnumDesktops() 无论我创建了多少个桌面,我总是得到相同的答案。 我得到两个名为:DummyDesktopForInstantResume 和 Default
的桌面看来 WinKey+Tab 'desktops' 与 EnumDesktops() 'desktops'.
不一样我用 Spy++ 做了一些额外的挖掘,它只显示一个根桌面,所有 windows 都属于那个桌面。无论 Spy++“出现”在哪个桌面上,它总是显示相同的 window 列表。而且无论应用程序出现在哪个桌面上,它始终具有相同的 window 句柄(正如预期的那样)。
有谁知道Windows11中如何枚举WinKey+TAB创建的虚拟桌面? 谢谢
So it seems that the WinKey+Tab 'desktops' are not the same as the EnumDesktops() 'desktops'.
不,他们不是。它们是用户当前 Win32 桌面中的“虚拟”桌面 运行。虚拟桌面只是一个 window 管理系统,一种让用户将多个 windows 组合在一起然后 hide/show 这些组作为一个整体的方法。 Raymond Chen 对此发表了博文:
Virtual desktops are an end-user window management feature, not a programmatic one
Virtual desktops are a window management feature, not a security feature or a performance feature. Furthermore, they are for end users to organize their windows, not for other programs to organize the windows.
Anyone knows how do we enumerate the virtual desktops created by WinKey+TAB in Windows 11?
不幸的是,没有 public API 可用于枚举这些虚拟桌面(但有一个 IVirtualDesktopManager
接口非常有限, 它允许您只查询给定的 window 是否属于当前活动的虚拟桌面,并将 window 移动到特定的虚拟桌面。仅此而已。