Okay, I looked at that multikey handler and understood enough of it to make my own. However, both that one and my own have one small problem - I'll explain a little bit of how a pure QB multikey handler works, in case you don't know, and then I'll explain what the problem is.
Basically, the multikey handler is put in the program's main loop; It then checks for keyboard input, and if it finds a certain key is pressed, it changes a corresponding array value to a number such as 1. Also, the multikey handler checks for keys that have just been un-pressed, and changes the corresponding array value to zero.
Here's a simple multikey handler; when escape is pressed, the program ends.
Code:
DECLARE FUNCTION Multikey (keynum)
DIM SHARED KeyInput(255)
DO
Esc = Multikey(1) '1 is the keycode for escape
IF Esc = 1 THEN END 'If Multikey returns 1, then it is pressed
LOOP
FUNCTION Multikey (keynum)
KeyInp = INP(96) 'Check for keyboard input
IF KeyInp <= 127 THEN 'Check for pressed keys
KeyInput(KeyInp) = 1
END IF
IF KeyInp >= 128 THEN 'Check for unpressed keys
KeyInput(KeyInp - 128) = 0
END IF
Multikey = KeyInput(keynum) 'Return value
END FUNCTION
This small bit of code works pretty slick - except for when another key is pressed before the handler detects the un-press of a different key.
Since the handler didn't detect the un-press of that key, the program acts as if that key is still down.
Simply optimizing the code for faster execution isn't the answer; the handler still occasionally misses an un-press. I've also tried running the function several times in the loop, but the problem still exists.
If anyone can find out a solution to this, then congratulations, because I sure can't!