I was experimenting with desktopduplication api sample code and it was mentioned here that

even full screen DirectX applications can be duplicated.
Also here it is mentioned that
>The following components of the operating system can generate the desktop image:

>* The DWM by composing the desktop image

>* A full-screen DirectX or OpenGL application

>* An application by switching to a separate desktop, for example, the secure desktop that is used to display the login screen
However when I tested the sample code with multiple monitors provided here, it worked fine for other applications running on desktop but when I started a fullscreen directx application, the running applications in the background are pushed onto the secondary monitor and only the secondary monitor is captured in the duplicated window.

What might be the reason for this? I ran the exact sample code provided by MSDN. Is there something more I need to do in order to capture DirectX fullscreen games using DesktopDuplication API