Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mika-f/dotnet-window-capture
Captures a window or desktop screen and renders it in WPF or DirectX.
https://github.com/mika-f/dotnet-window-capture
capture capture-screen csharp win32 windows
Last synced: 3 days ago
JSON representation
Captures a window or desktop screen and renders it in WPF or DirectX.
- Host: GitHub
- URL: https://github.com/mika-f/dotnet-window-capture
- Owner: mika-f
- License: mit
- Created: 2019-05-07T14:04:17.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-11-21T09:40:02.000Z (almost 2 years ago)
- Last Synced: 2024-05-02T02:21:28.035Z (7 months ago)
- Topics: capture, capture-screen, csharp, win32, windows
- Language: C#
- Homepage:
- Size: 40 KB
- Stars: 126
- Watchers: 10
- Forks: 30
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# .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 |- `Games` is checked using [Märchen Forest](https://anemonecoronaria.sakura.ne.jp/merufore/).
### 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](https://www.youtube.com/watch?v=rf2Lmfqi5ZM) 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
- [Microsoft.Windows.SDK.Contracts](https://www.nuget.org/packages/Microsoft.Windows.SDK.Contracts/)
- [SharpDX](https://www.nuget.org/packages/SharpDX/)### Code Includes
- [SharpDX Samples](https://github.com/sharpdx/SharpDX-Samples) (MIT)
- [Windows Universal Samples](https://github.com/microsoft/Windows-universal-samples) (MIT)
- [Windows.UI.Composition Win32 Samples](https://github.com/microsoft/Windows.UI.Composition-Win32-Samples) (MIT)