well i suggest you to read some cpp for example (or asm). the most common technique for keylogging is a "system-wide" hook on the keyboard.
you could read hxxp: win32assembly. online. fr/tut24. html for more information, all the iczelion tutz are great. I recommend you to check this site too - hxxp: jacquelin. potier. free. fr/winapioverride32/ , the author published his sources