This thread is two and a half years old. By the way, GetAsyncKeyState() will only work if you're lucky enough to call it when a key is pressed down. You most certainly can't log all keystrokes that way, especially without using up a ton of the user's cpu.