namespace Vanara.PInvoke;
/// Items from the WinMm.dll
public static partial class WinMm
{
///
public const int JOY_POV_NUMDIRS = 4;
///
[PInvokeData("mmddk.h")]
[Flags]
public enum JOY_ISCAL : uint
{
/// XY are calibrated
JOY_ISCAL_XY = 0x00000001,
/// Z is calibrated
JOY_ISCAL_Z = 0x00000002,
/// R is calibrated
JOY_ISCAL_R = 0x00000004,
/// U is calibrated
JOY_ISCAL_U = 0x00000008,
/// V is calibrated
JOY_ISCAL_V = 0x00000010,
/// POV is calibrated
JOY_ISCAL_POV = 0x00000020,
}
///
[PInvokeData("mmddk.h")]
public enum JOY_POVVAL : uint
{
///
JOY_POVVAL_FORWARD = 0,
///
JOY_POVVAL_BACKWARD = 1,
///
JOY_POVVAL_LEFT = 2,
///
JOY_POVVAL_RIGHT = 3,
}
///
[PInvokeData("mmddk.h")]
[StructLayout(LayoutKind.Sequential)]
public struct JOYPOS
{
///
public uint dwX;
///
public uint dwY;
///
public uint dwZ;
///
public uint dwR;
///
public uint dwU;
///
public uint dwV;
}
///
[PInvokeData("mmddk.h")]
[StructLayout(LayoutKind.Sequential)]
public struct JOYRANGE
{
///
public JOYPOS jpMin;
///
public JOYPOS jpMax;
///
public JOYPOS jpCenter;
}
/// The JOYREGHWVALUES structure contains the range of values returned by the hardware (filled in by calibration).
// https://docs.microsoft.com/en-us/windows/win32/api/mmddk/ns-mmddk-joyreghwvalues typedef struct joyreghwvalues_tag { JOYRANGE
// jrvHardware; DWORD dwPOVValues[JOY_POV_NUMDIRS]; DWORD dwCalFlags; } JOYREGHWVALUES, *LPJOYREGHWVALUES;
[PInvokeData("mmddk.h", MSDNShortId = "NS:mmddk.joyreghwvalues_tag")]
[StructLayout(LayoutKind.Sequential)]
public struct JOYREGHWVALUES
{
/// The values returned by the hardware.
public JOYRANGE jrvHardware;
/// The point-of-view (POV) values returned by the hardware.
[MarshalAs(UnmanagedType.LPArray, SizeConst = JOY_POV_NUMDIRS)]
public JOY_POVVAL[] dwPOVValues;
/// What has been calibrated.
public JOY_ISCAL dwCalFlags;
}
///
/// The
/// MDEVICECAPSEX
/// structure contains device capability information for Plug and Play (PnP) device drivers.
///
// https://docs.microsoft.com/en-us/windows/win32/api/mmddk/ns-mmddk-mdevicecapsex typedef struct { DWORD cbSize; LPVOID pCaps; } MDEVICECAPSEX;
[PInvokeData("mmddk.h", MSDNShortId = "NS:mmddk.__unnamed_struct_1")]
[StructLayout(LayoutKind.Sequential)]
public struct MDEVICECAPSEX
{
/// Specifies the size of the structure, in bytes.
public uint cbSize;
/// Specifies the capabilities of the device. The format of this data is device specific.
public IntPtr pCaps;
}
///
/// The
/// MIDIOPENDESC
/// structure is a client-filled structure that provides information about how to open a MIDI device.
///
// https://docs.microsoft.com/en-us/windows/win32/api/mmddk/ns-mmddk-midiopendesc typedef struct midiopendesc_tag { HMIDI hMidi;
// DWORD_PTR dwCallback; DWORD_PTR dwInstance; DWORD_PTR dnDevNode; DWORD cIds; MIDIOPENSTRMID rgIds[1]; } MIDIOPENDESC;
[PInvokeData("mmddk.h", MSDNShortId = "NS:mmddk.midiopendesc_tag")]
[StructLayout(LayoutKind.Sequential)]
public struct MIDIOPENDESC
{
///
/// Specifies the handle that the client uses to reference the device. This handle is assigned by WINMM. Use this handle when
/// you notify the client with the DriverCallback function.
///
public HMIDI hMidi;
///
/// Specifies either the address of a callback function, a window handle, or a task handle, depending on the flags that are
/// specified in the dwParam2 parameter of the MODM_OPEN message. If this field contains a handle, it is contained in the
/// low-order word.
///
public IntPtr dwCallback;
///
/// Specifies a pointer to a DWORD that contains instance information for the client. This instance information is returned to
/// the client whenever the driver notifies the client by using the DriverCallback function.
///
public IntPtr dwInstance;
/// Specifies a device node for the MIDI output device, if it is a Plug and Play (PnP) MIDI device.
public IntPtr dnDevNode;
/// Specifies the number of stream identifiers, if a stream is open.
public uint cIds;
/// Specifies an array of device identifiers. The number of identifiers is given by the cIds member.
[MarshalAs(UnmanagedType.LPArray, SizeConst = 1)]
public MIDIOPENSTRMID[] rgIds;
}
///
[PInvokeData("mmddk.h")]
[StructLayout(LayoutKind.Sequential)]
public struct MIDIOPENSTRMID
{
///
public uint dwStreamID;
///
public uint uDeviceID;
}
}