Posted on

delphi key state

procedure TForm1.Button1Click(Sender: TObject);
var
  KeyState : Word;
  S : String;
begin
  KeyState := GetKeyState(VK_SCROLL);
  S := 'Клавиша: VK_SCROLL. Состояние:';
  if KeyState and $8000 = $8000 then
    S := s+'down'
  else
    S := s+'up';
  if KeyState and 1 = 1 then
    S := S + 'toggle on'
  else
    S := S + 'toggle off'
  ;
  ShowMessage( S );
end;