Method to write pressed Keys into an Array

I wanted to record pressed Key Events into an array (for a small game), does any1 have a good method to achieve this???

thanx in advance

ChromeD