I think you'll probably have to check out the Windows API (if you are using Windows) for that. Check out http://msdn.microsoft.com there's a lot of good information on there assuming you can find what you are looking for.
If you are on UNIX/Linux you can get that from the X11 libraries. I can't remember exactly what the code looks like, but X11 will poll the keyboard and return an event anytime a key is pressed. There are some resources out on the web for more info.