GetAsyncKeyState函数功能:读取的是物理键状态,也是就是不管你怎么鼠标键盘映射,它只读取实际的按键状态。MSDN上给出了例子很恰当For example, the call GetAsyncKeyState(VK_LBUTTON) always returns the state of the left physical mouse button, regardless of whether it is mapped to the left or right logical mouse button.也就是说如果你重新设置了映射,GetAsyncKeyState还是只读取物理状态
GetAsyncKeyState的返回值:表示两个内容,一个是最高位bit的值,代表这个键是否被按下,按下为1,抬起为0;一个是最低位
bit的值,在windowsCE下要忽略(参考自MSDNIf the most significant bit is set, the key is down. The least significant
bit is not valid in Windows CE, and should be ignored.)
note:
GetAsyncKeyState('M')& 0x8000f // 要大写M, f的意思是float的意思