Question

I need to duplicate desktop in a set of 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(). MSDN says it means: The calling application is already duplicating this desktop output.

Is it possible to duplicate desktop to a few windows, not just one?

Was it helpful?

Solution 2

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().

After being created, this hidden window is mirrored to the required windows with using DWM as shown in my other answer:

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

The resulting performance is sufficient even for a few big (1920x1200) windows. The CPU load is no higher than 5%.

OTHER TIPS

Seems not with your approach, see remmars section of IDXGIOutput1::DuplicateOutput method

By default, only four processes can use a IDXGIOutputDuplication interface at the same time within a single session. 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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top