title: C++ Win32 keyboard events
body: <p>I am working on my keystroke logger for personal interest and asked a question related to this about yesterday; <a href="https://stackoverflow.com/questions/1430897/while-loop-taking-alot-of-cpu-usage">While loop using a lot of CPU</a>.</p>
  
  <p>The issue with the program was that it took too much CPU Usage, and people have suggested to make the inputs key-event based.</p>
  
  <p>Since I'm new to the Win32 API, I try to look for references and tutorials that will tell me how to create keyboard inputs as event-based, rather than poll based. But the problems is I could not found any solid examples or references, as it was quite difficult to understand for a complete newbie. </p>
  
  <p>Most of them mentioned that the event-based programming resided in GUI application, yet I want this keystroke logger application to be a console application.</p>
  
  <p>My two main questions from all this is:</p>
  
  <ul>
  <li>Can I write a event-based console keystroke logger with the Win32 API? If not, what are my options?</li>
  </ul>
  
  <p>and</p>
  
  <ul>
  <li>Does anyone have any reference websites that will help me understand how to capture keystrokes event-based?</li>
  </ul>
  
  <p>If additional information is needed, I am using Code Blocks under Windows XP with a GCC compiler.</p>