Gkumar
Gkumar

Reputation: 1

Shift + Numpad1 keys not working?

//I want to change gear in my dash bord ,but there is no out but of these keys

 if(pMsg->wParam==VK_SHIFT && pMsg->wParam==VK_NUMPAD1) 
 {   
     m_name.SetVariable("gear","1");
 }

Upvotes: 0

Views: 154

Answers (1)

Jabberwocky
Jabberwocky

Reputation: 50832

The expression (pMsg->wParam==VK_SHIFT && pMsg->wParam==VK_NUMPAD1) is always false.

Try this instead:

 if ( (pMsg->wParam == VK_NUMPAD1) && (GetKeyState(VK_SHIFT) & 0x80) != 0) ) 
 {   
     m_name.SetVariable("gear","1");
 }

You also may consider the use of an accelerator table instead.

Upvotes: 1

Related Questions