Giter Site home page Giter Site logo

dotnet-window-capture's Introduction

.NET Window Capture Samples

NOTE: This is an experimental project. Please use it at your own risk.

Captures a window or desktop screen and renders it in WPF or DirectX.

System Requirements

  • Windows 10 (64-bit, April 2018 Update)
  • DirectX 11
  • .NET Framework 4.7.2
  • Visual Studio 2019

Capture Methods

Project Name Minimal Windows Version Render To Platform
Win32.BitBlt Windows 95 DirectX Win32
Win32.DesktopDuplication Windows 8 DirectX Win32
Win32.DwmSharedSurface Windows 7 DirectX Win32
Win32.DwmThumbnail Windows 7 WPF Win32
WinRT.GraphicsCapture Windows 10 1803 DirectX WinRT

Comparison

Compare with capture target

Capture Method Window Capture Desktop Capture Outside of Desktop HW Acceleration DirectX Games
Win32.BitBlt Yes Yes Yes No Yes
Win32.DesktopDuplication No Yes No Yes Yes
Win32.DwmSharedSurface Yes No Yes No Yes
Win32.DwmThumbnail Yes No Yes Yes Yes
WinRT.GraphicsCapture Yes Yes Yes Yes Yes

Compare with capture source

Capture Method Window Handle Monitor Handle Another
Win32.BitBlt Yes No -
Win32.DesktopDuplication No No Device (Monitor)
Win32.DwmSharedSurface Yes No -
Win32.DwmThumbnail Yes No -
WinRT.GraphicsCapture Yes * Yes * Embedded Picker
  • *: Require Windows 10 1903 or greater.

Compare with delay

Capture Method Delay (ms)
Win32.BitBlt ~ 20ms
Win32.DesktopDuplication N/A
Win32.DwmSharedSurface ~ 20ms
Win32.DwmThumbnail 0ms
WinRT.GraphicsCapture ~ 40ms
  • I used this video to investigate the delay.
  • It is just a reference value, but it is certain that the delay of Win32.DwmThumbnail is 0 ms.
    • This is because it uses a drawing method that is entirely common to other windows.

License

This project is licensed under the MIT license.

Third-Party Notices

Dependencies

Code Includes

dotnet-window-capture's People

Contributors

mika-f avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dotnet-window-capture's Issues

[DwmThumbnail] Export frame as image

Hey checked the code for DwmThumbnail, It seems like you directly push the frame to the WPF window.
Is there any way to export the frame to an image?

Thanks.

Not compatible with .net6 or higher projects

Severity Code Description Project File Line Suppression State
Error NETSDK1149 WinRT.GraphicsCapture.exe cannot be referenced because it uses built-in support for WinRT, which is no longer supported in .NET 5 and higher. An updated version of the component supporting .NET 5 is needed. For more information, see https://aka.ms/netsdk1149 MyApp C:\Program Files\dotnet\sdk\7.0.401\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets 1047

DwmSharedSurface sample does not seem to be working with games, Edge, etc

I am using Windows 11 22H2 with NVidia graphics.

Trying to capture Edge, VS Code or video games (I tried on Dota 2) just returns blank texture.

I find it slightly weird as their windows have proper thumbnails in Win+Tab and the taskbar, which hints that DWM actually has their surfaces of some kind.

DwmSharedSurface Sample not Compiling

I have been trying to compile DwmSharedSurface Sample from the repo, but sharp dx is throwing exception like this:

SharpDX.SharpDXException: 'HRESULT: [0x80070057], Module: [General], ApiCode: [E_INVALIDARG/Invalid Arguments], Message: The parameter is incorrect.'

I tried changing shader file location but it still throw exception here:

using var vertexShader = new VertexShader(device, vertexShaderByteCode);

Could you please resolve this issue

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.