// This code is distributed under MIT license.
// Copyright (c) 2015 George Mamaladze
// See license.txt or https://mit-license.org/
using System;
using System.Runtime.InteropServices;
namespace Gma.System.MouseKeyHook.WinApi
{
///
/// The AppMouseStruct structure contains information about a application-level mouse input event.
///
///
/// See full documentation at http://globalmousekeyhook.codeplex.com/wikipage?title=MouseStruct
///
[StructLayout(LayoutKind.Explicit)]
internal struct AppMouseStruct
{
///
/// Specifies a Point structure that contains the X- and Y-coordinates of the cursor, in screen coordinates.
///
[FieldOffset(0x00)] public Point Point;
///
/// Specifies information associated with the message.
///
///
/// The possible values are:
///
/// -
/// 0 - No Information
///
/// -
/// 1 - X-Button1 Click
///
/// -
/// 2 - X-Button2 Click
///
/// -
/// 120 - Mouse Scroll Away from User
///
/// -
/// -120 - Mouse Scroll Toward User
///
///
///
[FieldOffset(0x16)] public short MouseData_x86;
[FieldOffset(0x22)] public short MouseData_x64;
///
/// Converts the current into a .
///
///
///
/// The AppMouseStruct does not have a timestamp, thus one is generated at the time of this call.
///
public MouseStruct ToMouseStruct()
{
var tmp = new MouseStruct();
tmp.Point = Point;
tmp.MouseData = IntPtr.Size == 4 ? MouseData_x86 : MouseData_x64;
tmp.Timestamp = Environment.TickCount;
return tmp;
}
}
}