From 476b02ba21a863f15195bc42418a6ad3495c30c8 Mon Sep 17 00:00:00 2001 From: dahall Date: Tue, 17 Aug 2021 13:02:39 -0600 Subject: [PATCH] Added SystemEventHandler.MessageWindowHandleCreated event --- PInvoke/User32/SystemEventHandler.cs | 7 +++++++ 1 file changed, 7 insertions(+) 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(); } }