From b6c6ae03d557b6bd55160757449d27e0b30a32b0 Mon Sep 17 00:00:00 2001 From: David Hall Date: Sat, 21 Jan 2023 17:52:46 -0700 Subject: [PATCH] Moved IWindowCore to MessagePump.cs --- PInvoke/User32/MessagePump.cs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) 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.