SHORT cap_state = ::GetKeyState(VK_CAPITAL); char str[10]; sprintf(str, "%d", cap_state); AfxMessageBox( CString(str) , MB_OK ); 会弹出0或者1