diff --git a/PInvoke/User32/WinUser.Message.cs b/PInvoke/User32/WinUser.Message.cs index afdf61bc..69906e09 100644 --- a/PInvoke/User32/WinUser.Message.cs +++ b/PInvoke/User32/WinUser.Message.cs @@ -2199,7 +2199,28 @@ namespace Vanara.PInvoke where TEnum : struct, IConvertible where TWP : struct, IConvertible where TLP : class { using var lp = new PinnedObject(lParam); - return SendMessage(hWnd, Convert.ToUInt32(msg), new IntPtr(Convert.ToInt64(wParam)), (IntPtr)lp); + return SendMessage(hWnd, Convert.ToUInt32(msg), new IntPtr(Convert.ToInt64(wParam)), lp); + } + + /// + /// Sends the specified message to a window or windows. The SendMessage function calls the window procedure for the specified window + /// and does not return until the window procedure has processed the message. + /// + /// The type of the value. + /// The type of the value. + /// + /// A handle to the window whose window procedure will receive the message. If this parameter is HWND_BROADCAST ((HWND)0xffff), the + /// message is sent to all top-level windows in the system, including disabled or invisible unowned windows, overlapped windows, and + /// pop-up windows; but the message is not sent to child windows. + /// + /// The message to be sent. + /// Additional message-specific information. + /// Additional message-specific information. + /// The return value specifies the result of the message processing; it depends on the message sent. + public static IntPtr SendMessage(HWND hWnd, TEnum msg, TWP wParam, IntPtr lParam = default) + where TEnum : struct, IConvertible where TWP : struct, IConvertible + { + return SendMessage(hWnd, Convert.ToUInt32(msg), new IntPtr(Convert.ToInt64(wParam)), lParam); } ///