procedure tForm1.HandleMessages(var Msg: tMsg; var Handled: Boolean);
begin
if (Msg.Message = WM_KeyDown) and
(Msg.wParam in [VK_UP, VK_DOWN, VK_LEFT, VK_RIGHT]) then
begin
case Msg.wParam of
VK_UP: ShowMessage('Нажата стрелка вверх');
VK_DOWN: ShowMessage('Нажата стрелка вниз');
VK_LEFT: ShowMessage('Нажата стрелка влево');
VK_RIGHT: ShowMessage('Нажата стрелка вправо');
end;
Handled := True;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Application.OnMessage := HandleMessages;
end;
|