WindowWatcher 0.1.0
See the version list below for details.
dotnet add package WindowWatcher --version 0.1.0
NuGet\Install-Package WindowWatcher -Version 0.1.0
<PackageReference Include="WindowWatcher" Version="0.1.0" />
paket add WindowWatcher --version 0.1.0
#r "nuget: WindowWatcher, 0.1.0"
// Install WindowWatcher as a Cake Addin #addin nuget:?package=WindowWatcher&version=0.1.0 // Install WindowWatcher as a Cake Tool #tool nuget:?package=WindowWatcher&version=0.1.0
Window Watcher SDK
The Window Watcher SDK allows you to listen for changes to the current foreground (active) window on Windows devices. The SDK takes advantage of the user32.dll
windowing APIs to get information about the current foreground (active) window on a device using P/Invoke.
Getting started
Get the SDK
If you want to build your own applications on the Window Watcher SDK, you can install the package into your dotnet application.
dotnet add package WindowWatcher
Or by adding the WindowWatcher
package in your NuGet package manager of choice.
To use the SDK, follow the Window Watcher SDK instructions.
Using the ForegroundWindowWatcher
The ForegroundWindowWatcher
is a simple class that can be used to listen for changes in the current foreground (active) window on a Windows device providing a Window
object with the window detail.
using WindowWatcher;
var windowWatcher = new ForegroundWindowWatcher();
windowWatcher.WindowChanged += (sender, args) =>
{
Console.WriteLine($"Window changed to {args.NewWindow?.Title}");
};
windowWatcher.Start();
Note, ForegroundWindowWatcher
has an IForegroundWindowWatcher
interface to ease the extensibility, testability, and support for dependency injection in your applications.
Getting the current foreground (active) window with the WindowHelper
In addition to the watcher, the WindowHelper
class has a GetCurrentForegroundWindow
method that you can use to get a point-in-time reference to the current foreground (active) window.
Window? currentWindow = WindowHelper.GetCurrentForegroundWindow();
Contributing 🤝🏻
Contributions, issues and feature requests are welcome!
Feel free to check the issues page. You can also take a look at the contributing guide.
We actively encourage you to jump in and help with any issues, and if you find one, don't forget to log it!
Support this project 💗
As many developers know, projects like this are built and maintained in maintainers' spare time. If you find this project useful, please Star the repo.
Author
👤 James Croft
- Website: https://www.jamescroft.co.uk
- Twitter: @jamesmcroft
- Github: @jamesmcroft
- LinkedIn: @jmcroft
License
This project is made available under the terms and conditions of the MIT license.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. 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. |
-
net6.0
- MADE.Threading (>= 1.6.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.