I never used SendInput, but it's possible that it interferes with the keyboard handler. Check if it still does not work when inkey() is active - the keyboard handler is deactivated during inkey.