qt 如何通過代碼實作shift按鍵被一直被按下,需要一直被按下,
uj5u.com熱心網友回復:
See Also Requirements Platform SDK: Windows User Interface
SendInput
The SendInput function synthesizes keystrokes, mouse motions, and button clicks.
UINT SendInput(
UINT nInputs, // count of input events
LPINPUT pInputs, // array of input events
int cbSize // size of structure
);
Parameters
nInputs
[in] Specifies the 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 will fail.
Return Values
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.
Remarks
The SendInput function inserts the events in the INPUT structures serially into the keyboard or mouse input stream. These events aren't 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.
Requirements
Windows NT/2000/XP: Included in Windows NT 4.0 SP3 and later.
Windows 95/98/Me: Included in Windows 98 and later.
Header: Declared in Winuser.h; include Windows.h.
Library: Use User32.lib.
See Also
Keyboard Input Overview, Keyboard Input Functions, INPUT, GetAsyncKeyState, keybd_event, mouse_event
Platform SDK Release: August 2001 What did you think of this topic?
Let us know. Order a Platform SDK CD Online
(U.S/Canada) (International)
Requirements
Windows NT/2000/XP: Included in Windows NT 4.0 SP3 and later.
Windows 95/98/Me: Included in Windows 98 and later.
Header: Declared in Winuser.h; include Windows.h.
Library: Use User32.lib.
See Also
Keyboard Input Overview, Keyboard Input Functions, INPUT, GetAsyncKeyState, keybd_event, mouse_event
uj5u.com熱心網友回復:
監聽鍵盤事件,第一次按下后設定定時器定時發送shift按下事件,再一次按下后移除定時器如果在鍵盤事件中回圈調起shift事件是很蠢的,你看能不能滿足你的需求
void QWidget::keyPressEvent(QKeyEvent *event)
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/285258.html
標籤:C++ 語言
下一篇:人工智能