// __in int X, __in int Y, __in int cx, __in int cy, __in UINT uFlags);
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
internalstaticexternboolSetWindowPos(
IntPtrhandle,
IntPtrinsertAfter,
intx,inty,intcx,intcy,
SetWindowPosFlagsflags
);
#endregion
#regionAdjustWindowRect
/// <summary>
/// Calculates the required size of the window rectangle, based on the desired client-rectangle size. The window rectangle can then be passed to the CreateWindow function to create a window whose client area is the desired size.
/// </summary>
/// <param name="lpRect">[in, out] Pointer to a RECT structure that contains the coordinates of the top-left and bottom-right corners of the desired client area. When the function returns, the structure contains the coordinates of the top-left and bottom-right corners of the window to accommodate the desired client area.</param>
/// <param name="dwStyle">[in] Specifies the window style of the window whose required size is to be calculated. Note that you cannot specify the WS_OVERLAPPED style.</param>
/// <param name="bMenu">[in] Specifies whether the window has a menu.</param>
/// <returns>
/// If the function succeeds, the return value is nonzero.
/// If the function fails, the return value is zero. To get extended error information, call GetLastError.
/// </returns>
/// <remarks>
/// A client rectangle is the smallest rectangle that completely encloses a client area. A window rectangle is the smallest rectangle that completely encloses the window, which includes the client area and the nonclient area.
/// The AdjustWindowRect function does not add extra space when a menu bar wraps to two or more rows.
/// The AdjustWindowRect function does not take the WS_VSCROLL or WS_HSCROLL styles into account. To account for the scroll bars, call the GetSystemMetrics function with SM_CXVSCROLL or SM_CYHSCROLL.
/// The ShowWindow function sets the specified window's show state.
/// </summary>
/// <param name="hWnd">[in] Handle to the window.</param>
/// <param name="nCmdShow">[in] Specifies how the window is to be shown. This parameter is ignored the first time an application calls ShowWindow, if the program that launched the application provides a STARTUPINFO structure. Otherwise, the first time ShowWindow is called, the value should be the value obtained by the WinMain function in its nCmdShow parameter. In subsequent calls, this parameter can be one of the ShowWindowEnum values.</param>
/// <returns>If the window was previously visible, the return value is true. Otherwise false.</returns>
/// <remarks>
/// <para>To perform certain special effects when showing or hiding a window, use AnimateWindow.</para>
/// <para>The first time an application calls ShowWindow, it should use the WinMain function's nCmdShow parameter as its nCmdShow parameter. Subsequent calls to ShowWindow must use one of the values in the given list, instead of the one specified by the WinMain function's nCmdShow parameter.</para>
/// <para>As noted in the discussion of the nCmdShow parameter, the nCmdShow value is ignored in the first call to ShowWindow if the program that launched the application specifies startup information in the structure. In this case, ShowWindow uses the information specified in the STARTUPINFO structure to show the window. On subsequent calls, the application must call ShowWindow with nCmdShow set to SW_SHOWDEFAULT to use the startup information provided by the program that launched the application. This behavior is designed for the following situations:</para>
/// <list type="">
/// <item>Applications create their main window by calling CreateWindow with the WS_VISIBLE flag set.</item>
/// <item>Applications create their main window by calling CreateWindow with the WS_VISIBLE flag cleared, and later call ShowWindow with the SW_SHOW flag set to make it visible.</item>
/// The SetWindowText function changes the text of the specified window's title bar (if it has one). If the specified window is a control, the text of the control is changed. However, SetWindowText cannot change the text of a control in another application.
/// </summary>
/// <param name="hWnd">[in] Handle to the window or control whose text is to be changed.</param>
/// <param name="lpString">[in] Pointer to a null-terminated string to be used as the new title or control text.</param>
/// <returns>
/// <para>If the function succeeds, the return value is nonzero.</para>
/// <para>If the function fails, the return value is zero. To get extended error information, call GetLastError.</para>
/// </returns>
/// <remarks>
/// <para>If the target window is owned by the current process, SetWindowText causes a WM_SETTEXT message to be sent to the specified window or control. If the control is a list box control created with the WS_CAPTION style, however, SetWindowText sets the text for the control, not for the list box entries. </para>
/// <para>To set the text of a control in another process, send the WM_SETTEXT message directly instead of calling SetWindowText. </para>
/// <para>The SetWindowText function does not expand tab characters (ASCII code 0x09). Tab characters are displayed as vertical bar (|) characters. </para>
/// <para>Windows 95/98/Me: SetWindowTextW is supported by the Microsoft Layer for Unicode (MSLU). To use this, you must add certain files to your application, as outlined in Microsoft Layer for Unicode on Windows 95/98/Me Systems .</para>
/// The GetWindowText function copies the text of the specified window's title bar (if it has one) into a buffer. If the specified window is a control, the text of the control is copied. However, GetWindowText cannot retrieve the text of a control in another application.
/// </summary>
/// <param name="hWnd">[in] Handle to the window or control containing the text.</param>
/// <param name="lpString">[out] Pointer to the buffer that will receive the text. If the string is as long or longer than the buffer, the string is truncated and terminated with a NULL character.</param>
/// <param name="nMaxCount">[in] Specifies the maximum number of characters to copy to the buffer, including the NULL character. If the text exceeds this limit, it is truncated.</param>
/// <returns>
/// If the function succeeds, the return value is the length, in characters, of the copied string, not including the terminating NULL character. If the window has no title bar or text, if the title bar is empty, or if the window or control handle is invalid, the return value is zero. To get extended error information, call GetLastError.
/// <para>This function cannot retrieve the text of an edit control in another application.</para>
/// </returns>
/// <remarks>
/// <para>If the target window is owned by the current process, GetWindowText causes a WM_GETTEXT message to be sent to the specified window or control. If the target window is owned by another process and has a caption, GetWindowText retrieves the window caption text. If the window does not have a caption, the return value is a null string. This behavior is by design. It allows applications to call GetWindowText without becoming unresponsive if the process that owns the target window is not responding. However, if the target window is not responding and it belongs to the calling application, GetWindowText will cause the calling application to become unresponsive.</para>
/// <para>To retrieve the text of a control in another process, send a WM_GETTEXT message directly instead of calling GetWindowText.</para>
/// <para>Windows 95/98/Me: GetWindowTextW is supported by the Microsoft Layer for Unicode (MSLU). To use this, you must add certain files to your application, as outlined in Microsoft Layer for Unicode on Windows 95/98/Me</para>
/// <returns>If the function succeeds, the return value is nonzero. If the function fails, the return value is zero. Windows NT/2000/XP: To get extended error information, call GetLastError.</returns>
/// <remarks>
/// <para>The function uses the window identified by the hWnd parameter and the screen coordinates given in the POINT structure to compute client coordinates. It then replaces the screen coordinates with the client coordinates. The new coordinates are relative to the upper-left corner of the specified window's client area. </para>
/// <para>The ScreenToClient function assumes the specified point is in screen coordinates. </para>
/// <para>All coordinates are in device units.</para>
/// <para>Do not use ScreenToClient when in a mirroring situation, that is, when changing from left-to-right layout to right-to-left layout. Instead, use MapWindowPoints. For more information, see "Window Layout and Mirroring" in Window Features.</para>
/// <param name="point">Pointer to a POINT structure that contains the client coordinates to be converted. The new screen coordinates are copied into this structure if the function succeeds.</param>
/// <returns>If the function succeeds, the return value is nonzero. If the function fails, the return value is zero. Windows NT/2000/XP: To get extended error information, call GetLastError.</returns>
/// <remarks>
/// <para>The ClientToScreen function replaces the client-area coordinates in the POINT structure with the screen coordinates. The screen coordinates are relative to the upper-left corner of the screen. Note, a screen-coordinate point that is above the window's client area has a negative y-coordinate. Similarly, a screen coordinate to the left of a client area has a negative x-coordinate.</para>
/// <para>All coordinates are device coordinates.</para>
/// The GetClientRect function retrieves the coordinates of a window's client area. The client coordinates specify the upper-left and lower-right corners of the client area. Because client coordinates are relative to the upper-left corner of a window's client area, the coordinates of the upper-left corner are (0,0).
/// </summary>
/// <param name="windowHandle">Handle to the window whose client coordinates are to be retrieved.</param>
/// <param name="clientRectangle">Pointer to a RECT structure that receives the client coordinates. The left and top members are zero. The right and bottom members contain the width and height of the window.</param>
/// <returns>
/// <para>If the function succeeds, the return value is nonzero.</para>
/// <para>If the function fails, the return value is zero. To get extended error information, call GetLastError.</para>
/// </returns>
/// <remarks>In conformance with conventions for the RECT structure, the bottom-right coordinates of the returned rectangle are exclusive. In other words, the pixel at (right, bottom) lies immediately outside the rectangle.</remarks>
/// The GetWindowRect function retrieves the dimensions of the bounding rectangle of the specified window. The dimensions are given in screen coordinates that are relative to the upper-left corner of the screen.
/// </summary>
/// <param name="windowHandle">Handle to the window whose client coordinates are to be retrieved.</param>
/// <param name="windowRectangle"> Pointer to a structure that receives the screen coordinates of the upper-left and lower-right corners of the window.</param>
/// <returns>
/// <para>If the function succeeds, the return value is nonzero.</para>
/// <para>If the function fails, the return value is zero. To get extended error information, call GetLastError.</para>
/// </returns>
/// <remarks>In conformance with conventions for the RECT structure, the bottom-right coordinates of the returned rectangle are exclusive. In other words, the pixel at (right, bottom) lies immediately outside the rectangle.</remarks>
/// The ChangeDisplaySettings function changes the settings of the default display device to the specified graphics mode.
/// </summary>
/// <param name="device_mode">[in] Pointer to a DEVMODE structure that describes the new graphics mode. If lpDevMode is NULL, all the values currently in the registry will be used for the display setting. Passing NULL for the lpDevMode parameter and 0 for the dwFlags parameter is the easiest way to return to the default mode after a dynamic mode change.</param>
/// <param name="flags">[in] Indicates how the graphics mode should be changed.</param>
/// <returns></returns>
/// <remarks>To change the settings of a specified display device, use the ChangeDisplaySettingsEx function.
/// <para>To ensure that the DEVMODE structure passed to ChangeDisplaySettings is valid and contains only values supported by the display driver, use the DEVMODE returned by the EnumDisplaySettings function.</para>
/// <para>When the display mode is changed dynamically, the WM_DISPLAYCHANGE message is sent to all running applications.</para>
/// Retrieves the cursor's position, in screen coordinates.
/// </summary>
/// <param name="point">Pointer to a POINT structure that receives the screen coordinates of the cursor.</param>
/// <returns>Returns nonzero if successful or zero otherwise. To get extended error information, call GetLastError.</returns>
/// <remarks>
/// <para>The cursor position is always specified in screen coordinates and is not affected by the mapping mode of the window that contains the cursor.</para>
/// <para>The calling process must have WINSTA_READATTRIBUTES access to the window station.</para>
/// <para>The input desktop must be the current desktop when you call GetCursorPos. Call OpenInputDesktop to determine whether the current desktop is the input desktop. If it is not, call SetThreadDesktop with the HDESK returned by OpenInputDesktop to switch to that desktop.</para>
/// On any other error, the function returns (UINT) -1 and GetLastError returns the error indication.
/// </returns>
[CLSCompliant(false)]
[DllImport("user32.dll", SetLastError = true)]
internalstaticexternUINTGetRawInputDeviceList(
[In, Out]IntPtrRawInputDeviceList,
[In, Out]refUINTNumDevices,
UINTSize
);
[DllImport("user32.dll", SetLastError = true)]
internalstaticexternINTGetRawInputDeviceList(
[In, Out]IntPtrRawInputDeviceList,
[In, Out]refINTNumDevices,
INTSize
);
#endregion
#regionGetRawInputDeviceInfo
/// <summary>
/// Gets information about the raw input device.
/// </summary>
/// <param name="Device">
/// Handle to the raw input device. This comes from the lParam of the WM_INPUT message,
/// from RawInputHeader.Device, or from GetRawInputDeviceList.
/// It can also be NULL if an application inserts input data, for example, by using SendInput.
/// </param>
/// <param name="Command">
/// Specifies what data will be returned in pData. It can be one of the following values.
/// RawInputDeviceInfoEnum.PREPARSEDDATA
/// Data points to the previously parsed data.
/// RawInputDeviceInfoEnum.DEVICENAME
/// Data points to a string that contains the device name.
/// For this Command only, the value in Size is the character count (not the byte count).
/// RawInputDeviceInfoEnum.DEVICEINFO
/// Data points to an RawInputDeviceInfo structure.
/// </param>
/// <param name="Data">
/// ointer to a buffer that contains the information specified by Command.
/// If Command is RawInputDeviceInfoEnum.DEVICEINFO, set RawInputDeviceInfo.Size to sizeof(RawInputDeviceInfo)
/// before calling GetRawInputDeviceInfo. (This is done automatically in OpenTK)
/// </param>
/// <param name="Size">
/// Pointer to a variable that contains the size, in bytes, of the data in Data.
/// </param>
/// <returns>
/// <para>If successful, this function returns a non-negative number indicating the number of bytes copied to Data.</para>
/// <para>If Data is not large enough for the data, the function returns -1. If Data is NULL, the function returns a value of zero. In both of these cases, Size is set to the minimum size required for the Data buffer.</para>
/// <para>Call GetLastError to identify any other errors.</para>
/// Handle to the raw input device. This comes from the lParam of the WM_INPUT message,
/// from RawInputHeader.Device, or from GetRawInputDeviceList.
/// It can also be NULL if an application inserts input data, for example, by using SendInput.
/// </param>
/// <param name="Command">
/// Specifies what data will be returned in pData. It can be one of the following values.
/// RawInputDeviceInfoEnum.PREPARSEDDATA
/// Data points to the previously parsed data.
/// RawInputDeviceInfoEnum.DEVICENAME
/// Data points to a string that contains the device name.
/// For this Command only, the value in Size is the character count (not the byte count).
/// RawInputDeviceInfoEnum.DEVICEINFO
/// Data points to an RawInputDeviceInfo structure.
/// </param>
/// <param name="Data">
/// ointer to a buffer that contains the information specified by Command.
/// If Command is RawInputDeviceInfoEnum.DEVICEINFO, set RawInputDeviceInfo.Size to sizeof(RawInputDeviceInfo)
/// before calling GetRawInputDeviceInfo. (This is done automatically in OpenTK)
/// </param>
/// <param name="Size">
/// Pointer to a variable that contains the size, in bytes, of the data in Data.
/// </param>
/// <returns>
/// <para>If successful, this function returns a non-negative number indicating the number of bytes copied to Data.</para>
/// <para>If Data is not large enough for the data, the function returns -1. If Data is NULL, the function returns a value of zero. In both of these cases, Size is set to the minimum size required for the Data buffer.</para>
/// <para>Call GetLastError to identify any other errors.</para>
/// <param name="RawInput">Handle to the RawInput structure. This comes from the lParam in WM_INPUT.</param>
/// <param name="Command">
/// Command flag. This parameter can be one of the following values.
/// RawInputDateEnum.INPUT
/// Get the raw data from the RawInput structure.
/// RawInputDateEnum.HEADER
/// Get the header information from the RawInput structure.
/// </param>
/// <param name="Data">Pointer to the data that comes from the RawInput structure. This depends on the value of uiCommand. If Data is NULL, the required size of the buffer is returned in Size.</param>
/// <param name="Size">Pointer to a variable that specifies the size, in bytes, of the data in Data.</param>
/// <param name="SizeHeader">Size, in bytes, of RawInputHeader.</param>
/// <returns>
/// <para>If Data is NULL and the function is successful, the return value is 0. If Data is not NULL and the function is successful, the return value is the number of bytes copied into Data.</para>
/// <para>If there is an error, the return value is (UINT)-1.</para>
/// </returns>
/// <remarks>
/// GetRawInputData gets the raw input one RawInput structure at a time. In contrast, GetRawInputBuffer gets an array of RawInput structures.
/// </remarks>
[CLSCompliant(false)]
[System.Security.SuppressUnmanagedCodeSecurity]
[DllImport("user32.dll", SetLastError = true)]
internalstaticexternUINTGetRawInputData(
HRAWINPUTRawInput,
GetRawInputDataEnumCommand,
[Out]LPVOIDData,
[In, Out]refUINTSize,
UINTSizeHeader
);
[System.Security.SuppressUnmanagedCodeSecurity]
[DllImport("user32.dll", SetLastError = true)]
internalstaticexternINTGetRawInputData(
HRAWINPUTRawInput,
GetRawInputDataEnumCommand,
[Out]LPVOIDData,
[In, Out]refINTSize,
INTSizeHeader
);
/// <summary>
/// Gets the raw input from the specified device.
/// </summary>
/// <param name="RawInput">Handle to the RawInput structure. This comes from the lParam in WM_INPUT.</param>
/// <param name="Command">
/// Command flag. This parameter can be one of the following values.
/// RawInputDateEnum.INPUT
/// Get the raw data from the RawInput structure.
/// RawInputDateEnum.HEADER
/// Get the header information from the RawInput structure.
/// </param>
/// <param name="Data">Pointer to the data that comes from the RawInput structure. This depends on the value of uiCommand. If Data is NULL, the required size of the buffer is returned in Size.</param>
/// <param name="Size">Pointer to a variable that specifies the size, in bytes, of the data in Data.</param>
/// <param name="SizeHeader">Size, in bytes, of RawInputHeader.</param>
/// <returns>
/// <para>If Data is NULL and the function is successful, the return value is 0. If Data is not NULL and the function is successful, the return value is the number of bytes copied into Data.</para>
/// <para>If there is an error, the return value is (UINT)-1.</para>
/// </returns>
/// <remarks>
/// GetRawInputData gets the raw input one RawInput structure at a time. In contrast, GetRawInputBuffer gets an array of RawInput structures.
/// Draws a frame (defined in the window's class description) around the window.
/// </summary>
DRAWFRAME=FRAMECHANGED,
/// <summary>
/// Same as the NOOWNERZORDER flag.
/// </summary>
NOREPOSITION=NOOWNERZORDER,
DEFERERASE=0x2000,
ASYNCWINDOWPOS=0x4000
}
#endregion
#endregion
#endregion
#regionRawInputstructures
#regionRawInputDevice
/// <summary>
/// Defines information for the raw input devices.
/// </summary>
/// <remarks>
/// If RIDEV_NOLEGACY is set for a mouse or a keyboard, the system does not generate any legacy message for that device for the application. For example, if the mouse TLC is set with RIDEV_NOLEGACY, WM_LBUTTONDOWN and related legacy mouse messages are not generated. Likewise, if the keyboard TLC is set with RIDEV_NOLEGACY, WM_KEYDOWN and related legacy keyboard messages are not generated.
/// </remarks>
[StructLayout(LayoutKind.Sequential)]
internalstructRawInputDevice
{
/// <summary>
/// Top level collection Usage page for the raw input device.
/// </summary>
//internal USHORT UsagePage;
internalSHORTUsagePage;
/// <summary>
/// Top level collection Usage for the raw input device.
/// </summary>
//internal USHORT Usage;
internalSHORTUsage;
/// <summary>
/// Mode flag that specifies how to interpret the information provided by UsagePage and Usage.
/// It can be zero (the default) or one of the following values.
/// By default, the operating system sends raw input from devices with the specified top level collection (TLC)
/// to the registered application as long as it has the window focus.
/// </summary>
internalRawInputDeviceFlagsFlags;
/// <summary>
/// Handle to the target window. If NULL it follows the keyboard focus.
/// <para>The handle to this structure is passed in the lParam parameter of WM_INPUT.</para>
/// <para>To get detailed information -- such as the header and the content of the raw input -- call GetRawInputData.</para>
/// <para>To get device specific information, call GetRawInputDeviceInfo with the hDevice from RAWINPUTHEADER.</para>
/// <para>Raw input is available only when the application calls RegisterRawInputDevices with valid device specifications.</para>
/// </remarks>
[StructLayout(LayoutKind.Sequential)]
internalstructRawInput
{
internalRawInputHeaderHeader;
internalRawInputDataData;
internalbyte[]ToByteArray()
{
unsafe
{
byte[]dump=newbyte[API.RawInputSize];
fixed(RawInputDeviceType*ptr=&Header.Type)
{
for(inti=0;i<API.RawInputSize;i++)
dump[i]=*((byte*)ptr+i);
returndump;
}
}
}
}
[StructLayout(LayoutKind.Explicit)]
internalstructRawInputData
{
[FieldOffset(0)]
internalRawMouseMouse;
[FieldOffset(0)]
internalRawKeyboardKeyboard;
[FieldOffset(0)]
internalRawHIDHID;
}
#endregion
#regionRawInputHeader
/// <summary>
/// Contains the header information that is part of the raw input data.
/// </summary>
/// <remarks>
/// To get more information on the device, use hDevice in a call to GetRawInputDeviceInfo.
/// </remarks>
[StructLayout(LayoutKind.Sequential)]
internalstructRawInputHeader
{
/// <summary>
/// Type of raw input.
/// </summary>
internalRawInputDeviceTypeType;
/// <summary>
/// Size, in bytes, of the entire input packet of data. This includes the RawInput struct plus possible extra input reports in the RAWHID variable length array.
/// </summary>
internalDWORDSize;
/// <summary>
/// Handle to the device generating the raw input data.
/// </summary>
internalHANDLEDevice;
/// <summary>
/// Value passed in the wParam parameter of the WM_INPUT message.
/// </summary>
internalWPARAMParam;
}
#endregion
#regionRawKeyboard
/// <summary>
/// Contains information about the state of the keyboard.
/// </summary>
[StructLayout(LayoutKind.Sequential)]
internalstructRawKeyboard
{
/// <summary>
/// Scan code from the key depression. The scan code for keyboard overrun is KEYBOARD_OVERRUN_MAKE_CODE.
/// </summary>
//internal USHORT MakeCode;
internalSHORTMakeCode;
/// <summary>
/// Flags for scan code information. It can be one or more of the following.
/// RI_KEY_MAKE
/// RI_KEY_BREAK
/// RI_KEY_E0
/// RI_KEY_E1
/// RI_KEY_TERMSRV_SET_LED
/// RI_KEY_TERMSRV_SHADOW
/// </summary>
internalRawInputKeyboardDataFlagsFlags;
/// <summary>
/// Reserved; must be zero.
/// </summary>
USHORTReserved;
/// <summary>
/// Microsoft Windows message compatible virtual-key code. For more information, see Virtual-Key Codes.
/// </summary>
//internal USHORT VKey;
internalVirtualKeysVKey;
/// <summary>
/// Corresponding window message, for example WM_KEYDOWN, WM_SYSKEYDOWN, and so forth.
/// </summary>
//internal UINT Message;
internalINTMessage;
/// <summary>
/// Device-specific additional information for the event.
/// </summary>
//internal ULONG ExtraInformation;
internalLONGExtraInformation;
}
#endregion
#regionRawMouse
/// <summary>
/// Contains information about the state of the mouse.
/// </summary>
[StructLayout(LayoutKind.Sequential, Pack=1)]
internalstructRawMouse
{
//internal RawMouseFlags Flags; // USHORT in winuser.h, but only INT works -- USHORT returns 0.
USHORTflags;
bytefor_alignment;// Not used -- used for alignment
/// <summary>
/// Reserved.
/// </summary>
//ULONG Buttons;
internalUSHORTbuttonFlags;
/// <summary>
/// If usButtonFlags is RI_MOUSE_WHEEL, this member is a signed value that specifies the wheel delta.
/// Defines the raw input data coming from the specified Human Interface Device (HID).
/// </summary>
[StructLayout(LayoutKind.Sequential)]
internalstructRawInputHIDDeviceInfo
{
/// <summary>
/// Vendor ID for the HID.
/// </summary>
internalDWORDVendorId;
/// <summary>
/// Product ID for the HID.
/// </summary>
internalDWORDProductId;
/// <summary>
/// Version number for the HID.
/// </summary>
internalDWORDVersionNumber;
/// <summary>
/// Top-level collection Usage Page for the device.
/// </summary>
//internal USHORT UsagePage;
internalSHORTUsagePage;
/// <summary>
/// Top-level collection Usage for the device.
/// </summary>
//internal USHORT Usage;
internalSHORTUsage;
}
#endregion
#regionRawInputKeyboardDeviceInfo
/// <summary>
/// Defines the raw input data coming from the specified keyboard.
/// </summary>
/// <remarks>
/// For the keyboard, the Usage Page is 1 and the Usage is 6.
/// </remarks>
[StructLayout(LayoutKind.Sequential)]
internalstructRawInputKeyboardDeviceInfo
{
/// <summary>
/// Type of the keyboard.
/// </summary>
internalDWORDType;
/// <summary>
/// Subtype of the keyboard.
/// </summary>
internalDWORDSubType;
/// <summary>
/// Scan code mode.
/// </summary>
internalDWORDKeyboardMode;
/// <summary>
/// Number of function keys on the keyboard.
/// </summary>
internalDWORDNumberOfFunctionKeys;
/// <summary>
/// Number of LED indicators on the keyboard.
/// </summary>
internalDWORDNumberOfIndicators;
/// <summary>
/// Total number of keys on the keyboard.
/// </summary>
internalDWORDNumberOfKeysTotal;
}
#endregion
#regionRawInputMouseDeviceInfo
/// <summary>
/// Defines the raw input data coming from the specified mouse.
/// </summary>
/// <remarks>
/// For the keyboard, the Usage Page is 1 and the Usage is 2.
/// </remarks>
[StructLayout(LayoutKind.Sequential)]
internalstructRawInputMouseDeviceInfo
{
/// <summary>
/// ID for the mouse device.
/// </summary>
internalDWORDId;
/// <summary>
/// Number of buttons for the mouse.
/// </summary>
internalDWORDNumberOfButtons;
/// <summary>
/// Number of data points per second. This information may not be applicable for every mouse device.
/// </summary>
internalDWORDSampleRate;
/// <summary>
/// TRUE if the mouse has a wheel for horizontal scrolling; otherwise, FALSE.
/// </summary>
/// <remarks>
/// This member is only supported under Microsoft Windows Vista and later versions.
/// </remarks>
internalBOOLHasHorizontalWheel;
}
#endregion
#endregion
#regionGetWindowLongOffsets
#endregion
#regionRectangle
/// <summary>
/// Defines the coordinates of the upper-left and lower-right corners of a rectangle.
/// </summary>
/// <remarks>
/// By convention, the right and bottom edges of the rectangle are normally considered exclusive. In other words, the pixel whose coordinates are (right, bottom) lies immediately outside of the the rectangle. For example, when RECT is passed to the FillRect function, the rectangle is filled up to, but not including, the right column and bottom row of pixels. This structure is identical to the RECTL structure.
/// </remarks>
[StructLayout(LayoutKind.Sequential)]
internalstructRectangle
{
internalRectangle(intwidth,intheight)
{
left=top=0;
right=width;
bottom=height;
}
/// <summary>
/// Specifies the x-coordinate of the upper-left corner of the rectangle.
/// </summary>
internalLONGleft;
/// <summary>
/// Specifies the y-coordinate of the upper-left corner of the rectangle.
/// </summary>
internalLONGtop;
/// <summary>
/// Specifies the x-coordinate of the lower-right corner of the rectangle.
/// </summary>
internalLONGright;
/// <summary>
/// Specifies the y-coordinate of the lower-right corner of the rectangle.
/// If set, this removes the top level collection from the inclusion list.
/// This tells the operating system to stop reading from a device which matches the top level collection.
/// </summary>
REMOVE=0x00000001,
/// <summary>
/// If set, this specifies the top level collections to exclude when reading a complete usage page.
/// This flag only affects a TLC whose usage page is already specified with RawInputDeviceEnum.PAGEONLY.
/// </summary>
EXCLUDE=0x00000010,
/// <summary>
/// If set, this specifies all devices whose top level collection is from the specified UsagePage.
/// Note that usUsage must be zero. To exclude a particular top level collection, use EXCLUDE.
/// </summary>
PAGEONLY=0x00000020,
/// <summary>
/// If set, this prevents any devices specified by UsagePage or Usage from generating legacy messages.
/// This is only for the mouse and keyboard. See RawInputDevice Remarks.
/// </summary>
NOLEGACY=0x00000030,
/// <summary>
/// If set, this enables the caller to receive the input even when the caller is not in the foreground.
/// Note that Target must be specified in RawInputDevice.
/// </summary>
INPUTSINK=0x00000100,
/// <summary>
/// If set, the mouse button click does not activate the other window.
/// </summary>
CAPTUREMOUSE=0x00000200,// effective when mouse nolegacy is specified, otherwise it would be an error
/// <summary>
/// If set, the application-defined keyboard device hotkeys are not handled.
/// However, the system hotkeys; for example, ALT+TAB and CTRL+ALT+DEL, are still handled.
/// By default, all keyboard hotkeys are handled.
/// NOHOTKEYS can be specified even if NOLEGACY is not specified and Target is NULL in RawInputDevice.
/// </summary>
NOHOTKEYS=0x00000200,// effective for keyboard.
/// <summary>
/// Microsoft Windows XP Service Pack 1 (SP1): If set, the application command keys are handled. APPKEYS can be specified only if NOLEGACY is specified for a keyboard device.
/// </summary>
APPKEYS=0x00000400,// effective for keyboard.
/// <summary>
/// If set, this enables the caller to receive input in the background only if the foreground application
/// does not process it. In other words, if the foreground application is not registered for raw input,
/// then the background application that is registered will receive the input.
/// </summary>
EXINPUTSINK=0x00001000,
DEVNOTIFY=0x00002000,
//EXMODEMASK = 0x000000F0
}
#endregion
#regionGetRawInputDataEnum
internalenumGetRawInputDataEnum
{
INPUT=0x10000003,
HEADER=0x10000005
}
#endregion
#regionRawInputDeviceInfoEnum
internalenumRawInputDeviceInfoEnum
{
PREPARSEDDATA=0x20000005,
DEVICENAME=0x20000007,// the return valus is the character length, not the byte size
DEVICEINFO=0x2000000b
}
#endregion
#regionRawInputMouseState
[Flags]
internalenumRawInputMouseState:ushort
{
LEFT_BUTTON_DOWN=0x0001,// Left Button changed to down.
LEFT_BUTTON_UP=0x0002,// Left Button changed to up.
RIGHT_BUTTON_DOWN=0x0004,// Right Button changed to down.
RIGHT_BUTTON_UP=0x0008,// Right Button changed to up.
MIDDLE_BUTTON_DOWN=0x0010,// Middle Button changed to down.
MIDDLE_BUTTON_UP=0x0020,// Middle Button changed to up.
/// Hides the window and activates another window.
/// </summary>
HIDE=0,
/// <summary>
/// Activates and displays a window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag when displaying the window for the first time.
/// Displays the window as a minimized window. This value is similar to SW_SHOWMINIMIZED, except the window is not activated.
/// </summary>
SHOWNOACTIVATE=4,
/// <summary>
/// Activates the window and displays it in its current size and position.
/// </summary>
SHOW=5,
/// <summary>
/// Minimizes the specified window and activates the next top-level window in the Z order.
/// </summary>
MINIMIZE=6,
/// <summary>
/// Displays the window as a minimized window. This value is similar to SW_SHOWMINIMIZED, except the window is not activated.
/// </summary>
SHOWMINNOACTIVE=7,
/// <summary>
/// Displays the window in its current size and position. This value is similar to SW_SHOW, except the window is not activated.
/// </summary>
SHOWNA=8,
/// <summary>
/// Activates and displays the window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag when restoring a minimized window.
/// </summary>
RESTORE=9,
/// <summary>
/// Sets the show state based on the SW_ value specified in the STARTUPINFO structure passed to the CreateProcess function by the program that started the application.
/// </summary>
SHOWDEFAULT=10,
/// <summary>
/// Windows 2000/XP: Minimizes a window, even if the thread that owns the window is not responding. This flag should only be used when minimizing windows from a different thread.
/// </summary>
FORCEMINIMIZE=11,
//MAX = 11,
// Old ShowWindow() Commands
//HIDE_WINDOW = 0,
//SHOW_OPENWINDOW = 1,
//SHOW_ICONWINDOW = 2,
//SHOW_FULLSCREEN = 3,
//SHOW_OPENNOACTIVATE= 4,
}
#endregion
#regionShowWindowMessageIdentifiers
/// <summary>
/// Identifiers for the WM_SHOWWINDOW message
/// </summary>
internalenumShowWindowMessageIdentifiers
{
PARENTCLOSING=1,
OTHERZOOM=2,
PARENTOPENING=3,
OTHERUNZOOM=4,
}
#endregion
#regionGDIcharset
/// <summary>
/// Enumerates the available character sets.
/// </summary>
internalenumGdiCharset
{
Ansi=0,
Default=1,
Symbol=2,
ShiftJIS=128,
Hangeul=129,
Hangul=129,
GB2312=134,
ChineseBig5=136,
OEM=255,
//#if(WINVER >= 0x0400)
Johab=130,
Hebrew=177,
Arabic=178,
Greek=161,
Turkish=162,
Vietnamese=163,
Thai=222,
EastEurope=238,
Russian=204,
Mac=77,
Baltic=186,
}
#endregion
#regionMapVirtualKeyType
internalenumMapVirtualKeyType
{
/// <summary>uCode is a virtual-key code and is translated into a scan code. If it is a virtual-key code that does not distinguish between left- and right-hand keys, the left-hand scan code is returned. If there is no translation, the function returns 0.</summary>
VirtualKeyToScanCode=0,
/// <summary>uCode is a scan code and is translated into a virtual-key code that does not distinguish between left- and right-hand keys. If there is no translation, the function returns 0.</summary>
ScanCodeToVirtualKey=1,
/// <summary>uCode is a virtual-key code and is translated into an unshifted character value in the low-order word of the return value. Dead keys (diacritics) are indicated by setting the top bit of the return value. If there is no translation, the function returns 0.</summary>
VirtualKeyToCharacter=2,
/// <summary>Windows NT/2000/XP: uCode is a scan code and is translated into a virtual-key code that distinguishes between left- and right-hand keys. If there is no translation, the function returns 0.</summary>