simulation - C++ simulate pressing of equal sign (=) and question mark (?) -
having problems simulating keypress of equal sign (=) , question mark (?). figured if there's no virtual key code two, should combine key presses , releases guy did ctrl-v: http://batchloaf.wordpress.com/2012/10/18/simulating-a-ctrl-v-keystroke-in-win32-c-or-c-using-sendinput/
my code "=" (shift + "+"):
input ip; ip.type = input_keyboard; ip.ki.wscan = 0; // hardware scan code key ip.ki.time = 0; ip.ki.dwextrainfo = 0; ip.ki.wvk = vk_lshift; ip.ki.dwflags = 0; // 0 key press sendinput(1, &ip, sizeof(input)); // press "+" key ip.ki.wvk = vk_oem_plus; ip.ki.dwflags = 0; // 0 key press sendinput(1, &ip, sizeof(input)); // release "+" key ip.ki.wvk = vk_oem_plus; ip.ki.dwflags = keyeventf_keyup; sendinput(1, &ip, sizeof(input)); // release "shift" key ip.ki.wvk = vk_lshift; ip.ki.dwflags = keyeventf_keyup; sendinput(1, &ip, sizeof(input));
it outputs "+" sign. need work on, preferably windows os, @ least windows xp (not sure if makes difference).
thank you.
the =
character non-capitalized character on =
/+
key, while +
capitalized character. thus, output equals sign, use (badly named) vk_oem_plus
virtual key code.
Comments
Post a Comment