Just in case your not sure what's happening, and you'd like a little insight, here is a quick overview:

GetKeyboardState returns a nonzero value if successful, otherwise it returns zero (which is why we only check KeyState if the return value of GetKeyboardState was nonzero). If GetKeyboardState does succeed it will fill the KeyState array with 256 bytes, each byte representing one of the keys on the keyboard. Of those bytes, for the majority of keys, only the high order bit determines whether the key is pressed or not (though toggle keys like CAPSLOCK and NUMLOCK work differently). Which is why we AND the value with 128 (or 10000000 in binary). If the result of that AND is not zero that means the high order bit must be one, and thus the key is being pressed.