From 01652401ea4f66f64872264c2aeb1ee4ec84b220 Mon Sep 17 00:00:00 2001 From: Xu Liu Date: Tue, 28 Dec 2021 18:08:10 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20DesktopDuplication?= =?UTF-8?q?=20=E6=8D=95=E8=8E=B7=E6=A8=A1=E5=BC=8F=E5=92=8C=E7=A6=81?= =?UTF-8?q?=E7=94=A8=20DirectFlip=20=E7=9A=84=E5=85=BC=E5=AE=B9=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Runtime/App.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Runtime/App.cpp b/Runtime/App.cpp index 620515aa2..317df0291 100644 --- a/Runtime/App.cpp +++ b/Runtime/App.cpp @@ -473,6 +473,16 @@ bool App::_DisableDirectFlip() { SPDLOG_LOGGER_ERROR(logger, MakeWin32ErrorMsg("SetLayeredWindowAttributes 失败")); } + if (_captureMode == 0 || _captureMode == 1) { + const RTL_OSVERSIONINFOW& version = Utils::GetOSVersion(); + if (Utils::CompareVersion(version.dwMajorVersion, version.dwMinorVersion, version.dwBuildNumber, 10, 0, 19041) >= 0) { + // 使 DDF 窗口无法被捕获到 + if (!SetWindowDisplayAffinity(_hwndDDF, WDA_EXCLUDEFROMCAPTURE)) { + SPDLOG_LOGGER_ERROR(logger, MakeWin32ErrorMsg("SetWindowDisplayAffinity 失败")); + } + } + } + if (!ShowWindow(_hwndDDF, SW_NORMAL)) { SPDLOG_LOGGER_ERROR(logger, MakeWin32ErrorMsg("ShowWindow 失败")); }