From 1ceb991c1b76a9fcd167387e6800d86bd362fae9 Mon Sep 17 00:00:00 2001 From: masm611 <2838105183@qq.com> Date: Sun, 5 Jan 2025 12:53:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3windows10=5F1909=E7=89=88?= =?UTF-8?q?=E6=9C=ACWGC=E6=95=85=E9=9A=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit windows10_1909版本的WGC不支持IsCursorCaptureEnabled,加了个动态判断防止异常与抓屏失败等。 但是这样就有可能会抓到光标导致图像识别失败,但是个人认为瘦死的骆驼比马大,没有这个api就不调用即可,好歹还能用一下 如果有必要,后面可以考虑加一个弹窗警告一下啥的,但是这样可能会让用户糟心,总不能逼人家换个系统吧?但是不弹窗呢又好像向用户隐藏了某些可能存在的错误,好像又不太对啥的。 只能说云原神的限制还是大了一点,要不要加弹窗我无法决策,还是由大佬来吧 --- Fischless.GameCapture/Graphics/GraphicsCapture.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Fischless.GameCapture/Graphics/GraphicsCapture.cs b/Fischless.GameCapture/Graphics/GraphicsCapture.cs index 31c86f77..6113635a 100644 --- a/Fischless.GameCapture/Graphics/GraphicsCapture.cs +++ b/Fischless.GameCapture/Graphics/GraphicsCapture.cs @@ -1,6 +1,6 @@ -using Fischless.GameCapture.Graphics.Helpers; +using System.Diagnostics; +using Fischless.GameCapture.Graphics.Helpers; using SharpDX.Direct3D11; -using System.Diagnostics; using Vanara.PInvoke; using Windows.Foundation.Metadata; using Windows.Graphics.Capture; @@ -55,7 +55,10 @@ public class GraphicsCapture : IGameCapture } _captureSession = _captureFramePool.CreateCaptureSession(_captureItem); - _captureSession.IsCursorCaptureEnabled = false; + if (ApiInformation.IsPropertyPresent("Windows.Graphics.Capture.GraphicsCaptureSession", "IsCursorCaptureEnabled")) + { + _captureSession.IsCursorCaptureEnabled = false; + } if (ApiInformation.IsWriteablePropertyPresent("Windows.Graphics.Capture.GraphicsCaptureSession", "IsBorderRequired")) { _captureSession.IsBorderRequired = false;