At the moment I am using the following code (DX/c++) to parse keystrokes
#define KEY_DOWN(vk_code) ((GetAsyncKeyState(vk_code) & 0x8000) ? 1 : 0)
if(KEY_DOWN(VK_F))
//handle
This code resulted in multiple "F"s spamming my screen because the key is held down multiple frames. So I resorted to make a BOOL to detect if it has already been parsed. If the key is released the BOOL is toggled back. So I have a very cumbersome code where each key has a BOOL and is checked with an IF statement.
My parser is limited by framerate etc. Most keyboard parsers also have a function where if you press a key down for more then 1 second it will add more letters, this won't work with my current code. If I were to implement it the way it is now I must add atleast 10 lines of code for each key.
Any suggestions? How does windows capture input in textboxes, can this be ported to DirectX?