Closed lizongying closed 2 years ago
The most common error from CreateFromWindow
is because the window provided is not available to capture. Does this happen with all windows or just some windows? Is there an application that can reliably reproduce this error when captured?
The most common error from is because the window provided is not available to capture. Does this happen with all windows or just some windows? Is there an application that can reliably reproduce this error when captured?
CreateFromWindow
same window
The most common error from
CreateFromWindow
is because the window provided is not available to capture. Does this happen with all windows or just some windows? Is there an application that can reliably reproduce this error when captured?
This error is raised for all windows
GraphicsCapturePicker is no problem
Ah sorry, I missed an important piece of information from your title. UWP and LowIL callers are blocked from calling CreateFromWindow
and CreateFromMonitor
, it's a Win32 only API.
To programmatically capture the screen from a UWP app, you'll need to use a different API:
graphicsCaptureProgrammatic
capability in your manifest.GraphicsCaptureAccess.RequestAsync
with GraphicsCaptureAccessKind.Programmatic
.GraphicsCaptureItem.TryCreateFromWindowId
.You can obtain WindowIds from WindowServies.FindAllTopLevelWindowIds
. Keep in mind that these APIs were introduced in Windows 11, and will not work on previous versions of Windows.
GraphicsCapturePicker
doesn't seem to support XboxGameBarWidget, and can't find any GraphicsCaptureItem
, which can be found on other pages. So I tried to use CreateFromWindow
, and if it can be solved, thank you very much!
Your best bet is using the new API on Windows 11.