我需要检索用户选择的窗口的句柄,然后检索其手柄。按下Alt+选项卡时,此窗口必须是显示的窗口之一。
我尝试使用 >,但它不会列举全屏UWP窗口。例如,如果您用照片应用程序打开图片并将其放入全屏幕,则枚举将不会枚举它。
然后,我尝试了
方法显示了Windows的列表,用户可以选择一个,但是它返回a graphicsCaptureItem ,我想您无法从中获得窗口句柄。
是否可以重复使用Alt+Tab窗口来执行此操作(或任何其他显示Windows列表的方式)并检索用户选择的窗口的句柄?
注意:我需要全部按下Alt+选项卡时显示的窗口,甚至全屏UWP窗口,而没有其他窗口。
I need to retrieve the handle of a window selected by the user and then retrieve its handle. This window must be one of those shown when ALT+TAB is pressed.
I tried enumerating the windows using EnumWindows, but it does not enumerate the full screen UWP windows. For example, if you open a picture with the Photos app and put it in full screen, EnumWindows will not enumerate it.
Then I tried EnumChildWindows because I thought it could enumerate everything, even fullscreen UWP windows, but probably not.
The GraphicsCapturePicker.PickSingleItemAsync method shows a list of windows and the user can pick one, but it returns a GraphicsCaptureItem and I guess you can't get the window handle from it.
Is it possible to reuse the ALT+TAB window to do this (or any other way that shows a list of windows) and retrieve the handle of the window selected by the user?
Note: I need all the windows shown when ALT+TAB is pressed, even the full screen UWP windows, and no others.
发布评论
评论(2)
我已经使用 spy ++ Enumwindows nor
EnumChildWindows
检索全屏UWP Windows的根所有者的手柄。但是,enumchildWindows
检索他们的子窗口,每个UWP窗口都有一个子窗口,其类名称为 applicationframeInputSinkwindow (和其他子女窗口)。然后,您可以使用getancestor检验根所有者窗口。因此,要检索“标准”窗口,您可以调用 Enumwindows 。
但是要检索全屏UWP Windows:
该示例显示了如何同时使用
Enumwindows
和EnumChildWindows
来枚举所有“ Alt+Tab Windows”,甚至是全屏UWP Windows。这些以两列 datagridview 以表格列出,并且与用户单击的行相对应的窗口句柄。当然,只要回调函数具有过滤不同窗口的所有必要的过滤器,您也可以只使用
EnumchildWindows
获取所有“ Alt+Tab Windows”。I have investigated with Spy++ and neither
EnumWindows
norEnumChildWindows
retrieve the handles of the root owners of full screen UWP windows. HoweverEnumChildWindows
retrieves their child windows, and each UWP window has a child window whose class name is ApplicationFrameInputSinkWindow (and other child windows). Then, you can retrive the root owner window with GetAncestor.So, to retrieve "standard" windows, you could call EnumWindows.
But to retrieve full screen UWP windows:
This sample shows how to use both
EnumWindows
andEnumChildWindows
to enumerate all "ALT+TAB windows", even full-screen UWP windows. These are listed in a Form with a two-column DataGridView and the window handle corresponding to the row the user clicks on is retrieved.Of course, you can also just use
EnumChildWindows
to get all "ALT+TAB windows", as long as the callback function has all the necessary filters to filter the different windows.这就是Microsoft在他们的“ nofollow noreferrer”>屏幕捕获示例示例的方式。
您会在 win32windowenumeration.h 。
This is how Microsoft did it in their Screen Capture example.
You'll find it in the Win32WindowEnumeration.h.