   Prevent repeating key press calls
  Hi, this question isn't exactly OpenGL specific but I have run into this issue with my OpenGL terrain editor.  I'm trying to allow the user to press certain keys to turn flags on and off, for example push the letter 'W' to toggle wireframe mode.  The problem is everytime the user presses the key the message loops processes the press multiple times, meaning the flag gets set on and off many times in rapid succession.  If I just barely tap the key I can sometimes get it to apply only once but often times I need to press it and hope that an odd number of calls are made.  Here is an example of my code:case WM_CHAR:switch(wParam)  {  case 'W':case 'w':  wireframeMode=!wireframeMode;  break;}What do I need to add or change to make it so it only applies once?  Thanks!   
  As far as I know WM_CHAR should let you do that toggling.I use it like that and it doesn't toggle multiple times,if I don't hold it down of course.However if I use WM_KEYDOWN it gets toggled multiple times even on one press.Also what happens when another char different thatn W is pressed?You don't have a break after the switch so it will just go through to the other case's.;  I do have the break in my code, I just wrote something quick up as an example.  So I am the only one who has this problem using WM_CHAR in this way?  I have 4 different toggles and this happens on all 4 of them...   ;  Ok, nevermind, I moved the calls to WM_KEYDOWN and now it works fine.  Thanks for the help!   ;  The way I would do is have an array called:keys[255];Catching the WM_KEYDOWN message you then set keys[keycode] to True. On WM_KEYUP You then set it to False.I then have a separate routine that goes through the keys array and actions based on the values in the array.   