diff --git a/PInvoke/User32/MessagePump.cs b/PInvoke/User32/MessagePump.cs index e4b49ed7..43e2c6ee 100644 --- a/PInvoke/User32/MessagePump.cs +++ b/PInvoke/User32/MessagePump.cs @@ -1,4 +1,5 @@ -using static Vanara.PInvoke.User32; +using System; +using static Vanara.PInvoke.User32; namespace Vanara.PInvoke; @@ -24,6 +25,20 @@ public interface IMessagePump int Run(IWindowCore mainWindow = null); } +/// An interface that represents a Win32 window with created and destroyed events. +public interface IWindowCore +{ + /// Occurs when the window is created and has a valid handle. + event Action Created; + + /// Occurs when the window has been destroyed. + event Action Destroyed; + + /// Gets the window handle. + /// The window handle. + HWND Handle { get; } +} + /// A basic message pump to use independently or with a window instance. /// /// Simple example of a window creation and message pump.