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
<PackageReference Include="Sibber.WindowMessageMonitor" Version="4.0.0" />
<PackageVersion Include="Sibber.WindowMessageMonitor" Version="4.0.0" />
<PackageReference Include="Sibber.WindowMessageMonitor" />
paket add Sibber.WindowMessageMonitor --version 4.0.0
#r "nuget: Sibber.WindowMessageMonitor, 4.0.0"
#:package Sibber.WindowMessageMonitor@4.0.0
#addin nuget:?package=Sibber.WindowMessageMonitor&version=4.0.0
#tool nuget:?package=Sibber.WindowMessageMonitor&version=4.0.0
Sibber.WindowMessageMonitor
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 | Versions 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. |
-
.NETStandard 2.0
- Microsoft.Bcl.HashCode (>= 6.0.0)
- Sibber.Common.Native.Windows (>= 3.0.1 && < 4.0.0)
- System.Memory (>= 4.6.3)
-
net8.0-windows7.0
- Sibber.Common.Native.Windows (>= 3.0.1 && < 4.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
- 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)