diff --git a/key/keypress_c.h b/key/keypress_c.h index 0a62afc..606b951 100644 --- a/key/keypress_c.h +++ b/key/keypress_c.h @@ -249,17 +249,20 @@ void unicodeType(const unsigned value){ toggleUnicode(ch, true); toggleUnicode(ch, false); #elif defined(IS_WINDOWS) - INPUT ip; + INPUT input[2]; + memset(input, 0, sizeof(input)); - // Set up a generic keyboard event. - ip.type = INPUT_KEYBOARD; - ip.ki.wVk = 0; // Virtual-key code - ip.ki.wScan = value; // Hardware scan code for key - ip.ki.time = 0; // System will provide its own time stamp. - ip.ki.dwExtraInfo = 0; // No extra info. Use the GetMessageExtraInfo function to obtain this information if needed. - ip.ki.dwFlags = KEYEVENTF_UNICODE; // KEYEVENTF_KEYUP for key release. + input[0].type = INPUT_KEYBOARD; + input[0].ki.wVk = 0; + input[0].ki.wScan = value; + input[0].ki.dwFlags = 0x4; // KEYEVENTF_UNICODE; - SendInput(1, &ip, sizeof(INPUT)); + input[1].type = INPUT_KEYBOARD; + input[1].ki.wVk = 0; + input[1].ki.wScan = value; + input[1].ki.dwFlags = KEYEVENTF_KEYUP | 0x4; // KEYEVENTF_UNICODE; + + SendInput(2, input, sizeof(INPUT)); #elif defined(USE_X11) toggleUniKey(value, true); toggleUniKey(value, false);