INPUT structure (Windows)

Switch View :
ScriptFree
INPUT structure

Applies to: desktop apps only

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

Syntax

typedef struct tagINPUT {
  DWORD type;
  union {
    MOUSEINPUT    mi;
    KEYBDINPUT    ki;
    HARDWAREINPUT hi;
  };
} INPUT, *PINPUT;

Members

type

Type: DWORD

The type of the input event. This member can be one of the following values.

ValueMeaning
INPUT_MOUSE
0

The event is a mouse event. Use the mi structure of the union.

INPUT_KEYBOARD
1

The event is a keyboard event. Use the ki structure of the union.

INPUT_HARDWARE
2

The event is a hardware event. Use the hi structure of the union.

 

mi

Type: MOUSEINPUT

The information about a simulated mouse event.

ki

Type: KEYBDINPUT

The information about a simulated keyboard event.

hi

Type: HARDWAREINPUT

The information about a simulated hardware event.

Remarks

INPUT_KEYBOARD supports nonkeyboard input methods, such as handwriting recognition or voice recognition, as if it were text input by using the KEYEVENTF_UNICODE flag. For more information, see the remarks section of KEYBDINPUT.

Requirements

Minimum supported client

Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Header

Winuser.h (include Windows.h)

See also

Reference
GetMessageExtraInfo
SendInput
keybd_event
mouse_event
HARDWAREINPUT
KEYBDINPUT
MOUSEINPUT
Conceptual
Keyboard Input

 

 

Send comments about this topic to Microsoft

Build date: 3/6/2012

Community Content

MarrySunny
A problem with INPUT using
When I try to use the INPUT structure, my compiler tells me this structure is undeclared, but I have included <windows.h>. After some searching, I find a solution, the <winable.h> should also be included. I don't know why, but it works.

rogerdpack2
how
Click on the links for HARDWAREINPUT KEYBDINPUT or MOUSEINPUT $0$0 $0
To actually see how to use this.
$0
$0 $0