请教键盘输入问题
打开一个界面,我想识别 按动键盘的‘上下左右’四个键,要怎么判断啊?
[解决办法]
窗体上放个ApplicationEvents控件,在onMessage事件中判断
void __fastcall TForm1::ApplicationEvents1Message(tagMSG &Msg,
bool &Handled)
{
if( Msg.message == WM_KEYDOWN)
{
if( Msg.wParam == VK_UP)
Caption = "1";
else if( Msg.wParam == VK_DOWN)
Caption = "2";
else if( Msg.wParam == VK_LEFT)
Caption = "3";
else if( Msg.wParam == VK_RIGHT)
Caption = "4";
}
}