using System; using System.Runtime.InteropServices; using Vanara.Extensions; namespace Vanara.PInvoke { public static partial class User32 { /// Contains information about a notification message. [StructLayout(LayoutKind.Sequential)] public struct NMHDR { /// A window handle to the control sending the message. public HWND hwndFrom; /// An identifier of the control sending the message. public IntPtr idFrom; /// /// A notification code. This member can be one of the common notification codes (see Notifications under General Control /// Reference), or it can be a control-specific notification code. /// public int code; /// Creates a structure from an LPARAM value. /// The LPARAM value. /// A structure. public static NMHDR FromLParam(IntPtr lParam) => (NMHDR)Marshal.PtrToStructure(lParam, typeof(NMHDR)); #if ALLOWSPAN /// Creates a reference to an structure from an LPARAM value. /// The LPARAM value. /// A structure reference. public static ref NMHDR LParamAsRef(IntPtr lParam) => ref lParam.AsRef(); #endif /// 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); } } }