DesktopDuplication 1.0.1

dotnet add package DesktopDuplication --version 1.0.1
NuGet\Install-Package DesktopDuplication -Version 1.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DesktopDuplication" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DesktopDuplication --version 1.0.1
#r "nuget: DesktopDuplication, 1.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install DesktopDuplication as a Cake Addin
#addin nuget:?package=DesktopDuplication&version=1.0.1

// Install DesktopDuplication as a Cake Tool
#tool nuget:?package=DesktopDuplication&version=1.0.1

Desktop Duplication API for .NET Core

Receive desktop frame data in real time, using the Windows 8 Desktop Duplication API.

Install using NuGet

How to use

Initialization

try
{
    desktopDuplicator = new DesktopDuplicator(0);
    // Desktop Duplication API initialized
}
catch (Exception ex)
{
    MessageBox.Show("An error occurred initializing the screen capture module.\nException: \n" + ex.ToString());
}

Screen Capture

public static Bitmap GetNextFrame()
{
    try
    {
        DesktopFrame frame = desktopDuplicator.GetLatestFrame();
        if (frame != null)
        {
            Bitmap frameBitmap = frame.DesktopImage;
            return frameBitmap;

        }
    }
    catch (Exception)
    {
        desktopDuplicator.Dispose();
        desktopDuplicator = new DesktopDuplicator(0);
        // Don't worry, exceptions are expected to happen
    }
    return null;
}

DesktopDuplicationException exceptions can occur when there is a change in the display mode, or a new frame isn't available yet. This can happen as a result of switching to a full-screen app, for example. The DesktopDuplicator object needs to be reinitialized because the SharpDX output duplication must be created for the specific display mode. You must call Dispose on the DesktopDuplicator object before creating a new one, or you will have memory leaks.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.1 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.1 747 6/17/2020
1.0.0 395 6/17/2020