Other Languages - in mfc to detect key a,d,w,s is the below method right?
Asked By lingaraj on 21-Aug-11 11:21 PM
once i have used onkeydown so i am using onkeyup now. if a is pressed some coordinates are moved i have made.
is the below method right to detect any key press
void MyWnd::OnKeyUp(UINT g,UINT j,UINT l)
MyWnd::OnKeyUp(UINT g,UINT j,UINT l)
{
switch(g)
{
case 'a':s1-=2;
s2-=2;
Invalidate();
break;
case 'd':s1+=2;
s2+=2;
Invalidate();
break;
case 'w':a1-=2;
a2-=2;
Invalidate();
break;
case 's':a1+=2;
a2+=2;
Invalidate();
break;
case 'k':KillTimer(100);
MessageBox("jmh");
break;
}
}