From 3291faad539a4744df25fa7751f80441d32302c8 Mon Sep 17 00:00:00 2001 From: vcaesar Date: Wed, 17 Oct 2018 16:12:48 -0400 Subject: [PATCH] use sendInput not keybd_event [docs: Note This function has been superseded] --- key/keypress_c.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/key/keypress_c.h b/key/keypress_c.h index 0ff73b8..6440a5a 100644 --- a/key/keypress_c.h +++ b/key/keypress_c.h @@ -103,7 +103,17 @@ void win32KeyEvent(int key, MMKeyFlags flags){ // scan |= 0x80; // } - keybd_event(key, scan, flags, 0); + // keybd_event(key, scan, flags, 0); + + INPUT keyInput; + + keyInput.type = INPUT_KEYBOARD; + keyInput.ki.wVk = key; + keyInput.ki.wScan = scan; + keyInput.ki.dwFlags = flags; + keyInput.ki.time = 0; + keyInput.ki.dwExtraInfo = 0; + SendInput(1, &keyInput, sizeof(keyInput)); } #endif