Desktop Duplication API截屏,宣称是支持win8+
win11测试没问题。在一个虚拟机win10里也没问题。但是在一个win10真机上就是access denied(通过ToDesk远程过去操作的)。
例子代码是这个:
github dot com /microsoft/Windows-classic-samples/tree/main/Samples/DXGIDesktopDuplication
access denied错误跟这个一样:
stackoverflow dot com /questions/46257471/desktop-duplication-screen-capturing-duplicateoutput-returns-e-accessdenied-er
主要就是这个的返回值:
// Create desktop duplication
hr = DxgiOutput1->DuplicateOutput(m_Device, &m_DeskDupl);
官方文档解释:
E_ACCESSDENIED if the application does not have access privilege to the current desktop image. For example, only an application that runs at LOCAL_SYSTEM can access the secure desktop.
但代码里已经设置了desktop了,很奇怪
--
修改:z16166 FROM 114.241.228.*
FROM 114.241.228.*