I have been trying to use the SendInput() function to simulate keyboard input with Unicode characters larger than 2 bytes. I can send characters like ∇ : 0x2207 using the INPUT structure:
INPUT puts[1] = { };
puts[0].type = INPUT_KEYBOARD;
puts[0].ki.dwFlags = KEYEVENTF_UNICODE;
puts[0].ki.wScan = 0x2207;
SendInput(1, puts, sizeof(puts));
However when I try to send something like 0x1D495, my character gets truncated to 0xD495 since the wScan member of the KEYBDINPUT (INPUT.ki) is just of type WORD which is only 2 bytes.
I am not experienced with Win32 API, but I have tried bypassing the SendInput() function at my own risk by using SendMessage(), but I am not confident in going about it that way without more formal knowledge. I have tried finding source code for SendInput() to see if I could do more without it, but I didn’t find much.
This thread How to use extended scancodes in SendInput addresses the same question, but I was unable to solve my problem since I am not sure what the implied values of tscancode, tvk, and dwFlags would be. Some combination of KEYEVENTF_EXTENDEDKEY, but I couldn’t pick apart much.
benwu93 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.