WindowWatcher 0.2.0

dotnet add package WindowWatcher --version 0.2.0
NuGet\Install-Package WindowWatcher -Version 0.2.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="WindowWatcher" Version="0.2.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add WindowWatcher --version 0.2.0
#r "nuget: WindowWatcher, 0.2.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install WindowWatcher as a Cake Addin
#addin nuget:?package=WindowWatcher&version=0.2.0

// Install WindowWatcher as a Cake Tool
#tool nuget:?package=WindowWatcher&version=0.2.0

Window Watcher SDK

GitHub release Build status Twitter Followers 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.

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

License

This project is made available under the terms and conditions of the MIT license.

Product 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 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • No dependencies.
  • net7.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.2.0 315 1/31/2023
0.1.1 256 9/1/2022
0.1.0 248 9/1/2022