Dapplo.Windows
Dapplo.Windows gives .NET applications on Windows access to the parts of the operating system which .NET doesn't cover: windows and their events, keyboard and mouse hooks, the clipboard, DPI awareness, power management, the Restart Manager, file dialogs and more. It was built for Greenshot and is split into small NuGet packages for .NET Framework 4.8 and .NET 10.
- Getting started: requirements, the packages and how the library works
- API reference
- Migrating to 3.0 and the changelog
- Source code and issues on GitHub
What you can do
| Topic | Package |
|---|---|
| Find, inspect, move and capture windows, react to window events | Dapplo.Windows |
| Receive window messages without a window of your own | Dapplo.Windows.Messages |
| Global keyboard and mouse hooks, hotkeys, send input | Dapplo.Windows.Input |
| Monitor, read and write the clipboard | Dapplo.Windows.Clipboard |
| Follow the DPI of each monitor | Dapplo.Windows.Dpi, .Forms, .Wpf |
| Keep the PC awake, sleep, shut down, wake timers, power events | Dapplo.Windows.SystemState |
| Survive updates: restart registration and installer support | Dapplo.Windows.AppRestartManager, .InstallerManager |
| Extract icons, write ICO / CUR files, capture the cursor | Dapplo.Windows.Icons |
| File and folder dialogs without WinForms or WPF | Dapplo.Windows.Dialogs |
| Windows Forms and WPF integration | Dapplo.Windows.Forms, .Wpf |
| Citrix, DWM, devices, registry, sounds and more | several |
| Recipes | several |
A first example
// using Dapplo.Windows.Input.Enums; using Dapplo.Windows.Input.Keyboard; using System.Reactive.Linq;
// Ctrl+Shift+S anywhere in Windows. The handler runs on the hook thread, ObserveOn moves the work to the UI thread.
IDisposable subscription = KeyboardHook.KeyboardEvents
.Where(new KeyCombinationHandler(VirtualKeyCode.Control, VirtualKeyCode.Shift, VirtualKeyCode.KeyS))
.ObserveOn(SynchronizationContext.Current)
.Subscribe(_ => Console.WriteLine("Ctrl+Shift+S pressed"));
License
MIT, see LICENSE.