简体   繁体   English

复制Windows桌面不止一次

[英]Duplicating Windows desktop more than one time

I need to duplicate desktop in a set of windows. 我需要在一组Windows中复制桌面。 I did it as follows: 我这样做如下:

ID3D11Device* Device;
D3D11CreateDevice(...&Device)
...
IDXGIOutputDuplication* DeskDupl;
IDXGIOutput1::DuplicateOutput(Device, DeskDupl);

For one window to duplicate the desktop it works OK, but for another window I get E_INVALIDARG on DuplicateOutput() . 对于一个窗口复制桌面,它可以正常工作,但是对于另一个窗口,我在DuplicateOutput()上得到E_INVALIDARG。 MSDN says it means: The calling application is already duplicating this desktop output. MSDN表示这意味着: The calling application is already duplicating this desktop output.

Is it possible to duplicate desktop to a few windows, not just one? 是否可以将桌面复制到几个窗口,而不仅仅是一个窗口?

Seems not with your approach, see remmars section of IDXGIOutput1::DuplicateOutput method 似乎不适合您的方法,请参阅IDXGIOutput1 :: DuplicateOutput方法的remmars部分

By default, only four processes can use a IDXGIOutputDuplication interface at the same time within a single session. 默认情况下,在单个会话中,只有四个进程可以同时使用IDXGIOutputDuplication接口。 A process can have only one desktop duplication interface on a single desktop output; 一个进程在一个桌面输出上只能有一个桌面复制接口。 however, that process can have a desktop duplication interface for each output that is part of the desktop. 但是,该过程可以为桌面的每个输出具有桌面复制界面。

But you might do it in other ways, if you just want to render same scene in different windows, I recommend using multiple swap-chains. 但是,如果您只想在不同的窗口中渲染同一场景,则可以用其他方法来实现,我建议使用多个交换链。

I have implemented this as creating a hidden window at coordinates (-32000, -32000), which is targeted as the primary screen output in DirectX IDXGIOutput1::DuplicateOutput() . 我将其实现为在坐标(-32000,-32000)处创建一个隐藏窗口,该窗口的目标是DirectX IDXGIOutput1::DuplicateOutput()的主屏幕输出。

After being created, this hidden window is mirrored to the required windows with using DWM as shown in my other answer : 创建后,此隐藏窗口将使用DWM镜像到所需的窗口,如我的其他答案所示:

hr = DwmRegisterThumbnail();
hr = DwmUpdateThumbnailProperties();

The resulting performance is sufficient even for a few big (1920x1200) windows. 即使对于几个大(1920x1200)窗口,所产生的性能也足够。 The CPU load is no higher than 5%. CPU负载不大于5%。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM