Keyboard and Mouse Input

Overview of the Keyboard and Mouse Input technology.

The Keyboard and Mouse Input technology is not associated with any headers.

For programming guidance for this technology, see:

Enumerations

 
TOOLTIP_DISMISS_FLAGS

The TOOLTIP_DISMISS_FLAGS enumeration defines constants that indicate whether a window is registered or unregistered to receive tooltip dismiss notifications.

Functions

 
_TrackMouseEvent

Posts messages when the mouse pointer leaves a window or hovers over a window for a specified amount of time. This function calls TrackMouseEvent if it exists, otherwise it emulates it.
ActivateKeyboardLayout

Sets the input locale identifier (formerly called the keyboard layout handle) for the calling thread or the current process. The input locale identifier specifies a locale as well as the physical layout of the keyboard.
BlockInput

Blocks keyboard and mouse input events from reaching applications.
DefRawInputProc

Verifies that the size of the RAWINPUTHEADER structure is correct.
DragDetect

Captures the mouse and tracks its movement until the user releases the left button, presses the ESC key, or moves the mouse outside the drag rectangle around the specified point.
EnableWindow

Enables or disables mouse and keyboard input to the specified window or control. When input is disabled, the window does not receive input such as mouse clicks and key presses. When input is enabled, the window receives all input.
GET_APPCOMMAND_LPARAM

Retrieves the application command from the specified LPARAM value.
GET_DEVICE_LPARAM

Retrieves the input device type from the specified LPARAM value.
GET_FLAGS_LPARAM

Retrieves the state of certain virtual keys from the specified LPARAM value. (GET_FLAGS_LPARAM)
GET_KEYSTATE_LPARAM

Retrieves the state of certain virtual keys from the specified LPARAM value. (GET_KEYSTATE_LPARAM)
GET_KEYSTATE_WPARAM

Retrieves the state of certain virtual keys from the specified WPARAM value.
GET_NCHITTEST_WPARAM

Retrieves the hit-test value from the specified WPARAM value.
GET_RAWINPUT_CODE_WPARAM

Retrieves the input code from wParam in WM_INPUT.
GET_WHEEL_DELTA_WPARAM

Retrieves the wheel-delta value from the specified WPARAM value.
GET_XBUTTON_WPARAM

Retrieves the state of certain buttons from the specified WPARAM value.
GetActiveWindow

Retrieves the window handle to the active window attached to the calling thread's message queue.
GetAsyncKeyState

Determines whether a key is up or down at the time the function is called, and whether the key was pressed after a previous call to GetAsyncKeyState.
GetCapture

Retrieves a handle to the window (if any) that has captured the mouse. Only one window at a time can capture the mouse; this window receives mouse input whether or not the cursor is within its borders.
GetDoubleClickTime

Retrieves the current double-click time for the mouse.
GetFocus

Retrieves the handle to the window that has the keyboard focus, if the window is attached to the calling thread's message queue.
GetKBCodePage

Retrieves the current code page.
GetKeyboardLayout

Retrieves the active input locale identifier (formerly called the keyboard layout).
GetKeyboardLayoutList

Retrieves the input locale identifiers (formerly called keyboard layout handles) corresponding to the current set of input locales in the system. The function copies the identifiers to the specified buffer.
GetKeyboardLayoutNameA

Retrieves the name of the active input locale identifier (formerly called the keyboard layout) for the calling thread. (ANSI)
GetKeyboardLayoutNameW

Retrieves the name of the active input locale identifier (formerly called the keyboard layout) for the calling thread. (Unicode)
GetKeyboardState

Copies the status of the 256 virtual keys to the specified buffer.
GetKeyboardType

Retrieves information about the current keyboard.
GetKeyNameTextA

Retrieves a string that represents the name of a key. (ANSI)
GetKeyNameTextW

Retrieves a string that represents the name of a key. (Unicode)
GetKeyState

Retrieves the status of the specified virtual key. The status specifies whether the key is up, down, or toggled (on, off�alternating each time the key is pressed).
GetLastInputInfo

Retrieves the time of the last input event.
GetMouseMovePointsEx

Retrieves a history of up to 64 previous coordinates of the mouse or pen.
GetRawInputBuffer

Performs a buffered read of the raw input data.
GetRawInputData

Retrieves the raw input from the specified device.
GetRawInputDeviceInfoA

Retrieves information about the raw input device. (ANSI)
GetRawInputDeviceInfoW

Retrieves information about the raw input device. (Unicode)
GetRawInputDeviceList

Enumerates the raw input devices attached to the system.
GetRegisteredRawInputDevices

Retrieves the information about the raw input devices for the current application.
IsWindowEnabled

Determines whether the specified window is enabled for mouse and keyboard input.
keybd_event

Synthesizes a keystroke.
LoadKeyboardLayoutA

Loads a new input locale identifier (formerly called the keyboard layout) into the system. (ANSI)
LoadKeyboardLayoutW

Loads a new input locale identifier (formerly called the keyboard layout) into the system. (Unicode)
MapVirtualKeyA

Translates (maps) a virtual-key code into a scan code or character value, or translates a scan code into a virtual-key code. (ANSI)
MapVirtualKeyExA

Translates (maps) a virtual-key code into a scan code or character value, or translates a scan code into a virtual-key code. The function translates the codes using the input language and an input locale identifier. (ANSI)
MapVirtualKeyExW

Translates (maps) a virtual-key code into a scan code or character value, or translates a scan code into a virtual-key code. The function translates the codes using the input language and an input locale identifier. (Unicode)
MapVirtualKeyW

Translates (maps) a virtual-key code into a scan code or character value, or translates a scan code into a virtual-key code. (Unicode)
mouse_event

The mouse_event function synthesizes mouse motion and button clicks.
NEXTRAWINPUTBLOCK

Retrieves the location of the next structure in an array of RAWINPUT structures.
OemKeyScan

Maps OEMASCII codes 0 through 0x0FF into the OEM scan codes and shift states. The function provides information that allows a program to send OEM text to another program by simulating keyboard input.
RegisterForTooltipDismissNotification

Lets apps or UI frameworks register and unregister windows to receive notification to dismiss their tooltip windows.
RegisterHotKey

Defines a system-wide hot key.
RegisterRawInputDevices

Registers the devices that supply the raw input data.
ReleaseCapture

Releases the mouse capture from a window in the current thread and restores normal mouse input processing.
SendInput

Synthesizes keystrokes, mouse motions, and button clicks.
SetActiveWindow

Activates a window. The window must be attached to the calling thread's message queue.
SetCapture

Sets the mouse capture to the specified window belonging to the current thread.
SetDoubleClickTime

Sets the double-click time for the mouse.
SetFocus

Sets the keyboard focus to the specified window. The window must be attached to the calling thread's message queue.
SetKeyboardState

Copies an array of keyboard key states into the calling thread's keyboard input-state table. This is the same table accessed by the GetKeyboardState and GetKeyState functions. Changes made to this table do not affect keyboard input to any other thread.
SwapMouseButton

Reverses or restores the meaning of the left and right mouse buttons.
ToAscii

Translates the specified virtual-key code and keyboard state to the corresponding character or characters.
ToAsciiEx

Translates the specified virtual-key code and keyboard state to the corresponding character or characters. The function translates the code using the input language and physical keyboard layout identified by the input locale identifier.
ToUnicode

Translates the specified virtual-key code and keyboard state to the corresponding Unicode character or characters. (ToUnicode)
ToUnicodeEx

Translates the specified virtual-key code and keyboard state to the corresponding Unicode character or characters. (ToUnicodeEx)
TrackMouseEvent

Posts messages when the mouse pointer leaves a window or hovers over a window for a specified amount of time.
UnloadKeyboardLayout

Unloads an input locale identifier (formerly called a keyboard layout).
UnregisterHotKey

Frees a hot key previously registered by the calling thread.
VkKeyScanA

Translates a character to the corresponding virtual-key code and shift state for the current keyboard. (ANSI)
VkKeyScanExA

Translates a character to the corresponding virtual-key code and shift state. The function translates the character using the input language and physical keyboard layout identified by the input locale identifier. (ANSI)
VkKeyScanExW

Translates a character to the corresponding virtual-key code and shift state. The function translates the character using the input language and physical keyboard layout identified by the input locale identifier. (Unicode)
VkKeyScanW

Translates a character to the corresponding virtual-key code and shift state for the current keyboard. (Unicode)

Structures

 
HARDWAREINPUT

Contains information about a simulated message generated by an input device other than a keyboard or mouse.
INPUT

Used by SendInput to store information for synthesizing input events such as keystrokes, mouse movement, and mouse clicks.
KEYBDINPUT

Contains information about a simulated keyboard event.
LASTINPUTINFO

Contains the time of the last input.
MOUSEINPUT

Contains information about a simulated mouse event.
MOUSEMOVEPOINT

Contains information about the mouse's location in screen coordinates.
RAWHID

Describes the format of the raw input from a Human Interface Device (HID).
RAWINPUT

Contains the raw input from a device.
RAWINPUTDEVICE

Defines information for the raw input devices.
RAWINPUTDEVICELIST

Contains information about a raw input device.
RAWINPUTHEADER

Contains the header information that is part of the raw input data.
RAWKEYBOARD

Contains information about the state of the keyboard.
RAWMOUSE

Contains information about the state of the mouse.
RID_DEVICE_INFO

Defines the raw input data coming from any device.
RID_DEVICE_INFO_HID

Defines the raw input data coming from the specified Human Interface Device (HID).
RID_DEVICE_INFO_KEYBOARD

Defines the raw input data coming from the specified keyboard.
RID_DEVICE_INFO_MOUSE

Defines the raw input data coming from the specified mouse.
TRACKMOUSEEVENT

Used by the TrackMouseEvent function to track when the mouse pointer leaves a window or hovers over a window for a specified amount of time.