WindowObserver ClassDW.WPFToolkit Documentation
Brings possibilities to easy listen for WinAPI events.
Inheritance Hierarchy

SystemObject
  DW.WPFToolkit.HelpersWindowObserver

Namespace: DW.WPFToolkit.Helpers
Assembly: DW.WPFToolkit (in DW.WPFToolkit.dll) Version: 5.6.0.0
Syntax

C#
public class WindowObserver

The WindowObserver type exposes the following members.

Constructors

  NameDescription
Public methodWindowObserver
Initializes a new instance of the WindowObserver class.
Top
Methods

  NameDescription
Public methodAddCallback
Registers a calback to be invoked when a WinAPI message appears in the observed window.
Public methodAddCallbackFor
Registers a calback to be invoked when the specific WinAPI message appears in the observed window.
Public methodClearCallbacks
Removes all registered callbacks.
Public methodRemoveCallback
Removed the previous registered callback.
Public methodRemoveCallbacksFor
Removes all callbacks which listen for a specific WinAPI message.
Top
Events

  NameDescription
Public eventMessage
Occurs when the observed window has send the a WinAPI message.
Top
Examples

C#
public partial class MainView
{
    public MainView()
    {
        InitializeComponent();

        var observer = new WindowObserver(this);
        observer.AddCallback(OnEventHappened);
    }

    private void OnEventHappened(NotifyEventArgs e)
    {
        if (e.MessageId == WindowMessages.WM_NCLBUTTONDBLCLK)
        {
            // User double clicked in the non client area (title bar mostly)
        }
    }
}
See Also

Reference