k.A. ob das was bringt, versuchs mal.
Delphi-Quellcode:
function KeyPressed : Integer;
var
i : Integer;
buf : TKeyboardState;
begin
Result := -1; // keine Taste gedrückt
if GetKeyboardState(buf) then
for i := 0 to High(buf) do
if (buf[i] and $80) <> 0 then
begin
Result := i;
Exit; // Taste gefunden dann Exit;
end;
end;
procedure TForm1.Timer1Timer(Sender: TObject); // interval = 25 ms
begin
label1.Caption := Inttostr(KeyPressed);
end;