Windows API Reference: Input
This section provides documentation for Windows API functions related to handling user input, including keyboard, mouse, and touch input.
Core Input Functions
GetKeyState
Retrieves the status of a specified key on the keyboard.
Parameters:
- nVirtKey: Specifies one of the virtual-key codes. For a list of virtual-key codes, see Virtual-Key Codes.
Return Value:
The return value specifies the status of the specified virtual key, as well as the status of the assembler for each of the controls keys. If the most significant bit of the return value is set, the key is down; otherwise, the key is up.
SetCursorPos
Moves the cursor to the specified position on the screen.
Parameters:
- X: The new horizontal position of the cursor, in screen coordinates.
- Y: The new vertical position of the cursor, in screen coordinates.
Return Value:
Nonzero if successful; otherwise, zero.
GetMouseButtonsState
Retrieves the current state of the mouse buttons.
Return Value:
A bitmask indicating which mouse buttons are pressed. Possible values include:
MK_LBUTTON
: Left mouse button is down.MK_RBUTTON
: Right mouse button is down.MK_MBUTTON
: Middle mouse button is down.MK_SHIFT
: SHIFT key is down.MK_CONTROL
: CTRL key is down.
Advanced Input Mechanisms
RegisterTouchWindow
Registers a window for touch input.
Parameters:
- hwnd: A handle to the window to register.
- ulFlags: Reserved. Must be zero.
Return Value:
TRUE if the function succeeds; otherwise, FALSE.
GetRawInputDeviceInfo
Retrieves information about the specified raw input device.
Parameters:
- hDevice: Handle to the raw input device.
- uiCommand: The information to retrieve. See Raw Input Commands.
- pData: Pointer to a buffer that receives the device information.