Sibber.WindowMessageMonitor 4.0.0

Prefix Reserved
dotnet add package Sibber.WindowMessageMonitor --version 4.0.0
                    
NuGet\Install-Package Sibber.WindowMessageMonitor -Version 4.0.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="Sibber.WindowMessageMonitor" Version="4.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Sibber.WindowMessageMonitor" Version="4.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Sibber.WindowMessageMonitor" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Sibber.WindowMessageMonitor --version 4.0.0
                    
#r "nuget: Sibber.WindowMessageMonitor, 4.0.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.
#:package Sibber.WindowMessageMonitor@4.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Sibber.WindowMessageMonitor&version=4.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Sibber.WindowMessageMonitor&version=4.0.0
                    
Install as a Cake Tool

Sibber.WindowMessageMonitor

NuGet Version License

A class that lets you listen to window messages for a given window, forked from dotMorten/WinUIEx.Messaging.WindowMessageMonitor.

Documentation

See full documentation and API reference at sibber5.github.io/Sibber.WindowMessageMonitor.

Usage

You must create and dispose of the WindowMessageReceived on the same thread as the window it would monitor was created on (regardless if it was created via the constructor or with CreateWithMessageOnlyWindow).
Make sure to dispose of it when you are done using it. Not doing so may cause problems such as memory leaks.

If you have an existing window:

var monitor = new WindowMessageMonitor(windowHandle);
monitor.WindowMessageReceived += (object sender, ref WindowMessageEventArgs e) =>
{
    Debug.WriteLine($"Recieved message: {e.MessageType} with wParam: {e.Message.WParam} and LParam: {e.Message.LParam}");

    // set e.Handled to true to return e.Result from the window procedure
    // (keep in mind that `WindowMessageEventArgs` is a readonly struct that is passed by ref,
    // so we set the parameter `e` to a new value to modify Handled and Result)
    e = e with { Handled = true, Result = 0 };
}

Or you can create a message-only window:

var monitor = WindowMessageMonitor.CreateWithMessageOnlyWindow();

Make sure to dispose when you're done using the instance:

monitor.Dispose();

The interface IWindowMessageMonitor is also provided in case you want to provide custom implementations, useful for things like other libraries that use this library.

License

The file src/WindowMessageMonitor.cs was taken from dotMorten/WinUIEx, MIT License - Copyright (c) 2021 Morten Nielsen. See the license notice at the top of the file for more info.

The rest of the library/repository is licensed under the MIT License - see LICENSE - unless otherwise stated in specific files or sections. See individual files for exceptions.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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.  net8.0-windows7.0 is compatible.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
4.0.0 171 10/12/2025
3.0.0 251 6/8/2025
2.0.5 155 6/7/2025
2.0.4 183 5/8/2025
2.0.3 186 5/8/2025
2.0.2 205 5/7/2025
2.0.1 197 5/4/2025
2.0.0 182 5/4/2025
1.2.1 157 5/3/2025
1.2.0 145 5/3/2025
1.1.0 116 5/3/2025
1.0.1 198 5/1/2025
1.0.0 201 5/1/2025

- IWindowMessageMonitor now implements IDisposable.
     - WindowMessageMonitor now monitors messages even when there are no subscribers to WindowMessageRecieved.
     - Added Free() method which disposes, and throws if there were any errors with disposal.
     - Full changelog: [v3.0.0..v4.0.0](https://github.com/sibber5/Sibber.WindowMessageMonitor/compare/v3.0.0...v4.0.0)