the most easiest way would be to use the GetAsyncKeyState() API, it is not the best and surely not the most beautiful way, but it works....
i have written one in C using that API, check out my site
here for the program and sourcecode (source is included in the zip file).
regards,