сорри
// returns true if the button is pressed at the time of invocation
static boolean isButtonDown(int keyId)
{
DLL _winApiDLL = new DLL('USER32');
DLLFunction _getKeyState = new DLLFunction(_winApiDLL, 'GetKeyState');
int retval;
_getKeyState.returns(ExtTypes::Word);
_getKeyState.arg(ExtTypes:

Word);
retval = _getKeyState.call(keyId);
return retval > 0x7FFF;
}