Desktop capture using directX 11
<p>I'm trying to capture desktop image using Direct 11 with SlimDX. But I don't know how to get the back buffer with directX 11 for the monitor desktop. I tried this with C# like this.Why doesn't it get the back buffer for the desktop?</p>

<pre><code>[DllImport("user32.dll", SetLastError = false)]

static extern IntPtr GetDesktopWindow();

Device device1;

SwapChain swapChain1;

      var description1 = new SwapChainDescription()
            {
                BufferCount = 1,
                Usage = Usage.ReadOnly,
                OutputHandle = GetDesktopWindow(),
                IsWindowed = true,
                ModeDescription = new ModeDescription(0, 0, new Rational(60, 1), Format.R8G8B8A8_UNorm),
                SampleDescription = new SampleDescription(1, 0),
                Flags = SwapChainFlags.AllowModeSwitch,
                SwapEffect = SwapEffect.Sequential
            };
Device.CreateWithSwapChain(DriverType.Hardware, DeviceCreationFlags.None, description, out device1, out swapChain1);

var resource1 = Resource.FromSwapChain&lt;Texture2D&gt;(swapChain1, 0);
 SlimDX.Direct3D11.Texture2D.SaveTextureToFile(context, resource1, ImageFileFormat.Png, "D:\\MyImage");
</code></pre>

<p>If not this way not work how can I capture desktop image with directX 11?
It will be really helpful if someone can answer.</p>