SendInput() and non-English characters and keyboard layouts
I'm having trouble simulating character keypresses when a non-English input keyboard language is being used in Windows. I tried calling SendInput() with KEYEVENTF_UNICODE: KEYBDINPUT ki; INPUT input; int character = 0; ki.wVk = 0; ki.wScan = character; ki.dwFlags = KEYEVENTF_UNICODE; ki.time = 0; ki.dwExtraInfo = 0; input.type = INPUT_KEYBOARD; input.ki = ki; SendInput(1, &input, sizeof(INPUT)); And this actually works (of course, in my code, I also do a KEYUP after the key down)... except in GTK+ apps (there may be other instances where it doesn't work either). According to MSDN , If