MightyGate
Hi all!
We are the "iHUD for" development team. For those who don't know what is "iHUD for", here are some links with stuff:
- http://www.youtube.com/watch?v=YN_2JQu5FPM
- http://www.youtube.com/watch?v=_ZQ__tPgH-E
- http://www.mightygate.com
Now that you now what we are doing, it comes our question. We are currently developing the 2.4 version of "iHUD for" which will include active buttons. Essentially, we will let you press a button on iHUD and it will simulate a keypress on you pc (the important thing is that you decide the key). Our problem is that every attempt to simulate a keyboard input on the InternalsPlugin (using the Windows API - SendInput function) is resolved the same way. It doesn't matter if we try to simulate "a", "b", "c" or "F4", rFactor always takes the input as a 'left ALT' event. Do you know some way to simulate the keyboard that actually works? Here is some code snippet:
void read(string iHudEvent)
{
INPUT input[1];
switch(parseIHUDEvent(iHudEvent))
{
case iHUD_EVENT_NORMAL_KEY_DOWN:
{
char keyChar = iHUDEvent.c_str()[0]; // A normal key down is an Ascii Key
SHORT keyCode = VkKeyScanA(keyChar);
input[0].type = INPUT_KEYBOARD;
input[0].ki.wVk = keyCode;
input[0].ki.dwFlags = 0;
}
break;
case IHUD_EVENT_NORMAL_KEY_UP:
{
char keyChar = iHUDEvent.c_str()[1]; // A normal key up is a '!' followed by an Ascii Key
SHORT keyCode = VkKeyScanA(keyChar);
input[0].type = INPUT_KEYBOARD;
input[0].ki.wVk = keyCode;
input[0].ki.dwFlags = KEYEVENTF_KEYUP;
}
break;
/// .....More switch stuff
}
input[0].ki.wVk = LOBYTE(input[0].ki.wVk);
::SendInput(1,input,sizeof(input));
Sleep(50); // Lets some time to game to recognize the keypress
}
We would appreciate any help! We know it's a very difficult and technical question.
Thank you in advance!!
Regards,
The Mightygate team
We are the "iHUD for" development team. For those who don't know what is "iHUD for", here are some links with stuff:
- http://www.youtube.com/watch?v=YN_2JQu5FPM
- http://www.youtube.com/watch?v=_ZQ__tPgH-E
- http://www.mightygate.com
Now that you now what we are doing, it comes our question. We are currently developing the 2.4 version of "iHUD for" which will include active buttons. Essentially, we will let you press a button on iHUD and it will simulate a keypress on you pc (the important thing is that you decide the key). Our problem is that every attempt to simulate a keyboard input on the InternalsPlugin (using the Windows API - SendInput function) is resolved the same way. It doesn't matter if we try to simulate "a", "b", "c" or "F4", rFactor always takes the input as a 'left ALT' event. Do you know some way to simulate the keyboard that actually works? Here is some code snippet:
void read(string iHudEvent)
{
INPUT input[1];
switch(parseIHUDEvent(iHudEvent))
{
case iHUD_EVENT_NORMAL_KEY_DOWN:
{
char keyChar = iHUDEvent.c_str()[0]; // A normal key down is an Ascii Key
SHORT keyCode = VkKeyScanA(keyChar);
input[0].type = INPUT_KEYBOARD;
input[0].ki.wVk = keyCode;
input[0].ki.dwFlags = 0;
}
break;
case IHUD_EVENT_NORMAL_KEY_UP:
{
char keyChar = iHUDEvent.c_str()[1]; // A normal key up is a '!' followed by an Ascii Key
SHORT keyCode = VkKeyScanA(keyChar);
input[0].type = INPUT_KEYBOARD;
input[0].ki.wVk = keyCode;
input[0].ki.dwFlags = KEYEVENTF_KEYUP;
}
break;
/// .....More switch stuff
}
input[0].ki.wVk = LOBYTE(input[0].ki.wVk);
::SendInput(1,input,sizeof(input));
Sleep(50); // Lets some time to game to recognize the keypress
}
We would appreciate any help! We know it's a very difficult and technical question.
Thank you in advance!!
Regards,
The Mightygate team