The SendInput function synthesizes keystrokes, mouse motions, and button clicks.
Syntax
UINT SendInput(
UINT nInputs, LPINPUT pInputs, int cbSize );
Parameters
nInputs
- [in] Number of structures in the pInputs array.
pInputs- [in] Pointer to an array of INPUT structures. Each structure represents an event to be inserted into the keyboard or mouse input stream.
cbSize- [in] Specifies the size, in bytes, of an INPUT structure. If cbSize is not the size of an INPUT structure, the function fails.
Return Value
The function returns the number of events that it successfully inserted into the keyboard or mouse input stream. If the function returns zero, the input was already blocked by another thread. To get extended error information, call GetLastError.
Microsoft Windows Vista. This function fails when it is blocked by User Interface Privilege Isolation (UIPI). Note that neither GetLastError nor the return value will indicate the failure was caused by UIPI blocking.
Remarks
Microsoft Windows Vista. This function is subject to UIPI. Applications are permitted to inject input only into applications that are at an equal or lesser integrity level.
The SendInput function inserts the events in the INPUT structures serially into the keyboard or mouse input stream. These events are not interspersed with other keyboard or mouse input events inserted either by the user (with the keyboard or mouse) or by calls to keybd_event, mouse_event, or other calls to SendInput.
This function does not reset the keyboard's current state. Any keys that are already pressed when the function is called might interfere with the events that this function generates. To avoid this problem, check the keyboard's state with the GetAsyncKeyState function and correct as necessary.
SendInput函数用于合成键盘按键、鼠标移动及点击等输入事件。它将事件按顺序插入到键盘或鼠标输入流中,不与其他输入事件混合。该函数接收三个参数:事件数量、事件数组及结构体大小。
1万+

被折叠的 条评论
为什么被折叠?



