Comments (7)
Shouldn't 19041 come with IsCursorCaptureEnabled support? I tried to use that in a netstandard2.0 project defining this:
PackageReference Include="Microsoft.Windows.SDK.Contracts" Version="10.0.19041.1"
ApiInformation.IsTypePresent(@"Windows.Graphics.Capture.GraphicsCaptureSession") results to TRUE but
ApiInformation.IsPropertyPresent(@"Windows.Graphics.Capture.GraphicsCaptureSession", @"IsCursorCaptureEnabled") is FALSE
Am I doing something wrong?
EDIT: Please excuse and ignore my question. I just checked whether I had the right SDK version installed which was not the case.
EDIT 2: Now that I have the right SDK installed I still see those results. Strange...
EDIT 3: gosh Windows10 just really really wasn't finished installing update 2004, so after some more restarts it now works.
I leave this comment here for anyone who might run into the same situation ;-)
from windows.ui.composition-win32-samples.
if(Windows.Foundation.Metadata.ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 10))
{
GraphicsCaptureSession.IsCursorCaptureEnabled = value; // maybe check
}
The way sometimes does not work in C# constructor.
Even if you set judgment, there may still be errors and errors will pop up.
It may be because C# will check all the property in advance,
so I use reflection to avoid it, AS SHOW BELOW
if (Windows.Foundation.Metadata.ApiInformation.IsApiContractPresent(
"Windows.Foundation.UniversalApiContract", 10))
{
var aa = GraphicsCaptureSession.GetType().GetProperty("IsCursorCaptureEnabled");
if (aa != null)
aa.SetValue(GraphicsCaptureSession,false);
}
Welcome to discuss.
from windows.ui.composition-win32-samples.
To check if capture is supported at all use the following (assumes Windows.Foundation.UniversalApiContract v1 is at least present):
auto supported =
winrt::Windows::Foundation::Metadata::ApiInformation::IsTypePresent(L"Windows.Graphics.Capture.GraphicsCaptureSession") &&
winrt::Windows::Graphics::Capture::GraphicsCaptureSession::IsSupported();
The first part checks to see if the capture API is present at all. The second part checks whether screen capture is present (e.g. This currently returns false on the Xbox).
To check for individual feature availability, use the following:
auto supported =
winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(
L"Windows.Graphics.Capture.GraphicsCaptureSession",
L"IsCursorCaptureEnabled");
PS: It is technically possible to use the capture API if IsSupported
returns false, but only by using GraphicsCaptureItem::CreateFromVisual
(your own content).
from windows.ui.composition-win32-samples.
I'll use these. Thanks.
from windows.ui.composition-win32-samples.
No problem!
from windows.ui.composition-win32-samples.
For window capture support as a whole, I'm going back to UniversalApiContract >= 8 for the time being. GraphicsCaptureSession exists on 1809, but IGraphicsCaptureItemInterop does not, so we were falsely reporting support for that version.
from windows.ui.composition-win32-samples.
Ah sorry, I should have mentioned that. We introduced the capture API before we introduced the Win32 specific interface. Since you rely on that, checking support for UniversalApiContract 8 is certainly the way to go.
from windows.ui.composition-win32-samples.
Related Issues (20)
- Some samples use `WindowsRuntimeMarshal` class, that is no longer available in .NET 5+ HOT 4
- Cannot use IGraphicsCaptureItemInterop::CreateForWindow with electron apps HOT 6
- This repo is missing important files HOT 4
- How to capture Windows10/11 Virtual Desktop via Windows.Graphics.Capture ? HOT 2
- Accessing screen capture image bytes with MapFlags.DoNotWait for better CPU usage HOT 3
- Can I do successive captures on two different windows HOT 8
- ScreenCapture Sample - write capture stream to disk mp4? HOT 5
- Capture area of a monitor HOT 4
- Memory Leak? HOT 5
- BSODs on 4 separate Hard Drives HOT 3
- Multiple screen captures in a loop cause explorer.exe and native Windows app to lag? HOT 11
- Capture OnFrame Callback very slow on Win11 23H2 HOT 7
- access_denied in CreateForMonitor in some cases HOT 5
- Cannot catch errors in CreateCaptureItemForWindow HOT 3
- WGC CaptureFrame returns wrong SystemRelativeTime in window capture mode HOT 2
- Cursor may become invisible when recording some fullscreen games using WGC HOT 6
- Frame has issue after change window state (maximize from normal/ normal from maximize/ ...) HOT 1
- ScreenCaptureforHWND sample leaks handles leading to "Out of memory" crash HOT 1
- ScreenCaptureforHWND sample main thread hang HOT 2
- ScreenCaptureforHWND: How to get the byte data of the captured frame? HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from windows.ui.composition-win32-samples.