diff --git a/PInvoke/User32/SystemEventHandler.cs b/PInvoke/User32/SystemEventHandler.cs index 0f811013..e8a24912 100644 --- a/PInvoke/User32/SystemEventHandler.cs +++ b/PInvoke/User32/SystemEventHandler.cs @@ -60,6 +60,9 @@ namespace Vanara.PInvoke Dispose(false); } + /// Occurs when the message window handle has been created. + public event EventHandler MessageWindowHandleCreated; + /// Gets a value indicating whether this instance is running in a thread. /// if this instance is running in a thread; otherwise, . public bool IsRunningInThread => ThreadRunning is not null; @@ -191,6 +194,9 @@ namespace Vanara.PInvoke { } + /// Called when the message window handle is created. + protected virtual void OnMessageWindowHandleCreated() => MessageWindowHandleCreated?.Invoke(this, EventArgs.Empty); + /// Calls the delegate list associated with the key, passing the supplied parameters. /// The key. /// The arguments. @@ -256,6 +262,7 @@ namespace Vanara.PInvoke private void Init() { msgWindow = new BasicMessageWindow(MessageFilter); + msgWindow.HandleCreated += (s, e) => OnMessageWindowHandleCreated(); } }