question

AzatTazayan avatar image
0 Votes"
AzatTazayan asked StriveSun-MSFT edited

DirectX composition issue

I'm trying to use DirectComposition on windows for drawing some visuals over Window and have following issue. Our application is multi plugin application and some of the windows already called CreateTargetForHwnd method to work with composition and now when I try to call CreateTargetForHwnd over that windows getting DCOMPOSITION_ERROR_WINDOW_ALREADY_COMPOSED exception. Is it possible to get IDCompositionTarget pointer if it is already created? I couldn't find such API.




windows-apic++
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

StriveSun-MSFT avatar image
0 Votes"
StriveSun-MSFT answered StriveSun-MSFT edited

Hello, @AzatTazayan

This is an error that has been documented.

DCOMPOSITION_ERROR_WINDOW_ALREADY_COMPOSED : The IDCompositionDevice::CreateTargetForHwnd method was called with hwnd and topmost parameters for which a visual tree already exists.

IDCompositionDevice::CreateTargetForHwnd method also pointed out, At most, only two composition targets can be created for each window in the system, one topmost and one not topmost. If a composition target is already bound to the specified window at the specified layer, this method fails. When a composition target object is destroyed, the layer it composed is available for use by a new composition target object.

I noticed that you posted the same question on another forum, where someone pointed out that you might not be able to do this for code that does not belong to you.

I agree with what he said.



Thank you!

If the answer is helpful, please click "Accept Answer" and upvote it.

Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.