NickeManarin/ScreenToGif · error · Exception

Too many applications using the Desktop Duplication API. Ple

Error message

Too many applications using the Desktop Duplication API. Please close one of the applications and try again.

What it means

Thrown by DirectImageCapture when output1.DuplicateOutput(Device) raises a SharpDXException with the NotCurrentlyAvailable DXGI result. The Desktop Duplication API (DDA) allows only one active duplication session per output at a time; a second attempt returns NotCurrentlyAvailable.

Source

Thrown at ScreenToGif/Capture/DirectImageCapture.cs:190

            OptionFlags = ResourceOptionFlags.None,
            MipLevels = 1,
            SampleDescription = new SampleDescription(1, 0),
            Usage = ResourceUsage.Default
        });

        using (var factory = new Factory1())
        {
            //Get the Output1 based on the current capture region position.
            using (var output1 = GetOutput(factory))
            {
                try
                {
                    //Make sure to run with the integrated graphics adapter if using a Microsoft hybrid system. https://stackoverflow.com/a/54196789/1735672
                    DuplicatedOutput = output1.DuplicateOutput(Device);
                }
                catch (SharpDXException e) when (e.Descriptor == SharpDX.DXGI.ResultCode.NotCurrentlyAvailable)
                {
                    throw new Exception("Too many applications using the Desktop Duplication API. Please close one of the applications and try again.", e);
                }
                catch (SharpDXException e) when (e.Descriptor == SharpDX.DXGI.ResultCode.Unsupported)
                {
                    throw new GraphicsConfigurationException("The Desktop Duplication API is not supported on this computer.", e);
                }
                catch (SharpDXException e) when (e.Descriptor == SharpDX.DXGI.ResultCode.InvalidCall)
                {
                    throw new GraphicsConfigurationException("The Desktop Duplication API is not supported on this screen.", e);
                }
                catch (SharpDXException e) when (e.Descriptor.NativeApiCode == "E_INVALIDARG")
                {
                    throw new GraphicsConfigurationException("Looks like that the Desktop Duplication API is not supported on this screen.", e);
                }
            }
        }
    }

    /// <summary>

View on GitHub (pinned to a4d0a67c21)

Solutions

  1. Close other screen recording applications that may be using DDA on the same monitor.
  2. Restart ScreenToGif or the conflicting application to release the stale DDA session.
  3. Ensure DuplicatedOutput is properly disposed (Dispose pattern) when capture stops.
  4. Switch to a different capture method (e.g., GDI-based) as a fallback when DDA is unavailable.

Example fix

// before
catch (SharpDXException e) when (e.Descriptor == SharpDX.DXGI.ResultCode.NotCurrentlyAvailable)
{
    throw new Exception("Too many applications using the Desktop Duplication API. Please close one of the applications and try again.", e);
}

// after: retry once after a brief delay, then throw if still unavailable
catch (SharpDXException e) when (e.Descriptor == SharpDX.DXGI.ResultCode.NotCurrentlyAvailable)
{
    DuplicatedOutput?.Dispose();
    await Task.Delay(500);
    try { DuplicatedOutput = output1.DuplicateOutput(Device); }
    catch { throw new Exception("Too many applications using the Desktop Duplication API...", e); }
}
Defensive patterns

Strategy: try-catch

Try / catch

try
{
    InitializeDesktopDuplication();
}
catch (Exception ex) when (ex.Message.Contains("Too many applications"))
{
    // Prompt user to close conflicting apps or fall back to BitBlt
    CaptureMode = CaptureMode.BitBlt;
}

Prevention

When it happens

Trigger: DuplicateOutput is called while another process already holds a DDA session on the same monitor. Conflicting apps: other screen recorders (OBS, ShareX, Snagit), remote desktop software, or a previous ScreenToGif capture session that did not properly release its DuplicatedOutput.

Common situations: User has another screen recording tool running on the same monitor. ScreenToGif crashed or was force-closed without disposing the DuplicatedOutput, leaving a stale DDA session. Windows RDP session is active on the target output. Multiple instances of ScreenToGif are capturing the same screen.

Related errors


AI-assisted analysis of NickeManarin/ScreenToGif@a4d0a67c21 (2026-08-13). Data as JSON: /api/errors/b2fbfdd72cf64718. Report an issue: GitHub.