0

This Code should let press my Application the key '1' on my NumPad:

ctrlV[5].type = INPUT_KEYBOARD;
ctrlV[5].ki.wVk =0x61; //VK_NUMPAD1

ctrlV[6].type = INPUT_KEYBOARD;
ctrlV[6].ki.wVk =0x61;  //OR VK_NUMPAD1
ctrlV[6].ki.dwFlags = KEYEVENTF_KEYUP;

SendInput(8, ctrlV, sizeof(INPUT));

It sends the key '1', although my NumLock is off. So my question is:

"How to simulate a keypress from the Number Pad ?"

I tried keyeventf_extendedkey; too without luck.

Thanks in advance!

agold
  • 6,140
  • 9
  • 38
  • 54
killertoge
  • 333
  • 1
  • 4
  • 13
  • You should be more specific. Where do you want to simulate this keypress? E.g. in a textfield of your webbrowser? Your question should contain code which actually compiles. It's easiert to help you then. – TruckerCat Dec 10 '15 at 14:09
  • 1
    You need to combine both flags using OR: `KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP` – Andrew Komiagin Dec 10 '15 at 14:11
  • @R_Valdez I want to simulate it on a textbox ... this is just a small part of my code ... usually it holds 'alt' , presses '2' '1' '9' on the Number Pad , and releases 'alt' so we would get a ASCII char ' █ ' – killertoge Dec 10 '15 at 14:18
  • Maybe this will be usefull for you? https://batchloaf.wordpress.com/2012/04/17/simulating-a-keystroke-in-win32-c-or-c-using-sendinput/ – TruckerCat Dec 10 '15 at 14:19
  • @AndrewKomiagin this 'combine' doesn't work :/ ctrlV[2].ki.dwFlags = KEYEVENTF_EXTENDEDKEY|KEYEVENTF_KEYUP; – killertoge Dec 11 '15 at 12:54

0 Answers0