From 5af855aeb2f613885cb4f310843e6d57c9a09af2 Mon Sep 17 00:00:00 2001 From: dahall Date: Wed, 2 Mar 2022 15:05:34 -0700 Subject: [PATCH] Added helper functions to WINDOWPOS to help when using it with LPARAM values. --- PInvoke/User32/WinUser.Gdi.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/PInvoke/User32/WinUser.Gdi.cs b/PInvoke/User32/WinUser.Gdi.cs index 72a31c33..8ea78342 100644 --- a/PInvoke/User32/WinUser.Gdi.cs +++ b/PInvoke/User32/WinUser.Gdi.cs @@ -3044,6 +3044,15 @@ namespace Vanara.PInvoke /// The window position. This member can be one or more of the following values. public SetWindowPosFlags flags; + + /// Creates a structure from an LPARAM value. + /// The LPARAM value. + /// A structure. + public static WINDOWPOS FromLParam(IntPtr lParam) => (WINDOWPOS)Marshal.PtrToStructure(lParam, typeof(WINDOWPOS)); + + /// Updates the value pointed to by an LPARAM value from this instance. + /// The LPARAM value to update. + public void UpdateLParam(IntPtr lParam) => Marshal.StructureToPtr(this, lParam, false); } /// Special window handles