I cannot offer any alternative solutions, because you still haven't told us why you want to capture key strokes, or what you're going to do with the data.
For all we know, you could be looking to capture a user's data input in a really round-about way. You haven't clarified your requirements either way.