[Help] C++ SendInput
[PHP]
void GenerateKey(BYTE vk) {
INPUT Input;
ZeroMemory(&Input, sizeof(Input));
Input.type = INPUT_KEYBOARD;
Input.ki.dwFlags = KEYEVENTF_EXTENDEDKEY;
Input.ki.wVk = vk;
SendInput(1, &Input, sizeof(INPUT));
return;
}
GenerateKey((UCHAR)VkKeyScan('1'));
GenerateKey(0x31);
[/PHP]
I'm trying to use SendInput to activate an in-game Hotkey(1) which uses a Health Pot bound to that Key.. The problem is that it only calls the 1 Hotkey once, after that it will not use another Potion but it will output 1's in the text-box.. I've narrowed the problem down to the function not releasing the Key after calling it(KEYEVENTF_KEYUP) however I am not sure how to include this in the SendInput function >_<..
Pretty much all I need is a little help understanding how to use the code I have now(which does what I want it to.. almost..) and then release the Key(KEYEVENTF_KEYUP) so that the next time it's called it will be ready again..
Thanks in advance!
+NULL
void GenerateKey(BYTE vk) {
INPUT Input;
ZeroMemory(&Input, sizeof(Input));
Input.type = INPUT_KEYBOARD;
Input.ki.dwFlags = KEYEVENTF_EXTENDEDKEY;
Input.ki.wVk = vk;
SendInput(1, &Input, sizeof(INPUT));
return;
}
GenerateKey((UCHAR)VkKeyScan('1'));
GenerateKey(0x31);
[/PHP]
I'm trying to use SendInput to activate an in-game Hotkey(1) which uses a Health Pot bound to that Key.. The problem is that it only calls the 1 Hotkey once, after that it will not use another Potion but it will output 1's in the text-box.. I've narrowed the problem down to the function not releasing the Key after calling it(KEYEVENTF_KEYUP) however I am not sure how to include this in the SendInput function >_<..
Pretty much all I need is a little help understanding how to use the code I have now(which does what I want it to.. almost..) and then release the Key(KEYEVENTF_KEYUP) so that the next time it's called it will be ready again..
Thanks in advance!
+NULL


