MCPcopy Create free account
hub / github.com/Zalafina/QKeyMapper / sendKeyboardInput

Method sendKeyboardInput

QKeyMapper/qkeymapper_worker.cpp:2527–2554  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2525}
2526
2527void QKeyMapper_Worker::sendKeyboardInput(V_KEYCODE vkeycode, int keyupdown)
2528{
2529 INPUT keyboard_input = { 0 };
2530 DWORD extenedkeyflag = 0;
2531 if (true == vkeycode.ExtenedFlag){
2532 extenedkeyflag = KEYEVENTF_EXTENDEDKEY;
2533 }
2534 else{
2535 extenedkeyflag = 0;
2536 }
2537 keyboard_input.type = INPUT_KEYBOARD;
2538 keyboard_input.ki.time = 0;
2539 keyboard_input.ki.dwExtraInfo = VIRTUAL_RESEND_REALKEY;
2540 keyboard_input.ki.wVk = vkeycode.KeyCode;
2541 keyboard_input.ki.wScan = MapVirtualKey(keyboard_input.ki.wVk, MAPVK_VK_TO_VSC);
2542 if (KEY_DOWN == keyupdown) {
2543 keyboard_input.ki.dwFlags = extenedkeyflag | 0;
2544 }
2545 else {
2546 keyboard_input.ki.dwFlags = extenedkeyflag | KEYEVENTF_KEYUP;
2547 }
2548 UINT uSent = SendInput(1, &keyboard_input, sizeof(INPUT));
2549 if (uSent != 1) {
2550#ifdef DEBUG_LOGOUT_ON
2551 qDebug("sendKeyboardInput(): SendInput failed: 0x%X\n", HRESULT_FROM_WIN32(GetLastError()));
2552#endif
2553 }
2554}
2555
2556void QKeyMapper_Worker::sendMouseClick(V_MOUSECODE vmousecode, int keyupdown)
2557{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected