Does GetKeyState() detect if the key is being released?

Is there a way to detect if the key is being released using GetKeyState()? I read about it, and it only has 2 states, Toggled 0x8000 and Pressed 0x01.

I want something like this:

short Input(int Key, int Mode)
   if (Mode == KEY_RELEASE)
      if (GetKeyState(Key) & KEY_PRESS)
         //Wait for the key to be released
         return GetKeyState(Key) & KEY_PRESS;


GetKeyState returns information about the key state of the current input queue (your thread and attached threads). You can get similar information for all the keys with GetKeyboardState.

Those two functions should only be used in response to some event, you should not be polling over and over to detect changes.

The best way to detect keyboard changes in windows you control is to handle WM_KEYDOWN/UP and WM_CHAR messages.

Worst case scenario, use SetWindowsHookEx to catch keyboard events or window messages.