If you need to trap only keyboard input only on your application, then you can override On Key Down message in the form. But you want to trap the keys form other applications, then you need to implement a hook.
Check for windows hook tutorials in the Internet.
Tom