You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the RibbonFormHelper::WndProc there is this peace of code
else if (m.Msg == WinApi.WM_NCHITTEST && (int)m.Result == 0) //0x84
{
m.Result = new IntPtr(Convert.ToInt32(NonClientHitTest(WinApi.GetPoint(m.LParam))));
handled = true;
}
The cast to int is wrong. I have received a message with LParam = 4294508536 that throw an Overflow exception.
I suggest this function to convert a LParam to the corresponding x,y coordinate
/// <summary>
/// Retrieve the signed x,y-coordinate from the specified LPARAM value`
/// </summary>
/// <param name="lParam"></param>
/// <returns></returns>
public static Point GetPoint(IntPtr lParam)
{
int value = unchecked((int)(long)lParam);
int x = (short)(value & 0xffff);
int y = (short)((value >> 16) & 0xffff);
return new Point(x, y);
}
In the RibbonFormHelper::WndProc there is this peace of code
The cast to int is wrong. I have received a message with LParam = 4294508536 that throw an Overflow exception.
I suggest this function to convert a LParam to the corresponding x,y coordinate
See also this API https://docs.microsoft.com/en-us/windows/win32/api/windowsx/nf-windowsx-get_x_lparam
The text was updated successfully, but these errors were encountered: