/// <summary> /// Implements the GET_WHEEL_DELTA_WPARAM macro. /// </summary> /// /// <remarks> /// For details, refer to /// https://msdn.microsoft.com/en-us/library/ms646254.aspx. /// </remarks> public static short GetWheelDeltaWParam(IntPtr wParam) { byte[] source = BitConverter.GetBytes(wParam.ToInt64()); byte[] final = new byte[2]; Win32Utilities.CopyLeastSignificantBytes(source, final, 2); return(BitConverter.ToInt16(final, 0)); }
/// <summary> /// Implements the GET_KEYSTATE_WPARAM macro. /// </summary> /// /// <remarks> /// For details, refer to /// https://msdn.microsoft.com/en-us/library/ms646251.aspx. /// </remarks> public static KeyStates GetKeyStateWParam(IntPtr wParam) { byte[] source = BitConverter.GetBytes(wParam.ToInt64()); byte[] intermediate = new byte[2]; Win32Utilities.CopyLeastSignificantBytes(source, intermediate); byte[] final = new byte[4]; Win32Utilities.CopyLeastSignificantBytes(intermediate, final); return((KeyStates)BitConverter.ToInt32(final, 0)); }
/// <summary> /// Implements the GET_Y_LPARAM macro. /// </summary> /// /// <remarks> /// For details, refer to /// https://msdn.microsoft.com/en-us/library/ms632655.aspx. /// </remarks> public static int GetYLParam(IntPtr lParam) { byte[] source = BitConverter.GetBytes(lParam.ToInt64()); byte[] intermediate = new byte[2]; Win32Utilities.CopyLeastSignificantBytes(source, intermediate, 2); byte[] final = new byte[4]; Win32Utilities.CopyLeastSignificantBytes(intermediate, final); return(BitConverter.ToInt32(final, 0)); }