DesktopDuplication 1.0.1
dotnet add package DesktopDuplication --version 1.0.1
NuGet\Install-Package DesktopDuplication -Version 1.0.1
<PackageReference Include="DesktopDuplication" Version="1.0.1" />
paket add DesktopDuplication --version 1.0.1
#r "nuget: DesktopDuplication, 1.0.1"
// 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.
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 | Versions 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. |
-
.NETCoreApp 3.1
- Microsoft.CSharp (>= 4.7.0)
- SharpDX (>= 4.2.0)
- SharpDX.Direct3D11 (>= 4.2.0)
- SharpDX.DXGI (>= 4.2.0)
- System.Data.DataSetExtensions (>= 4.5.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.