Einfach den aktuellen Status einer Taste merken, los geht's :
Delphi-Quellcode:
//...
implementation
//...
type
TKeyState = (ksUp, ksDown);
var
KeyState: TKeyState;
Counter : Integer = 0;
procedure TForm1.FormKeyUp(Sender: TObject; var Key:Word;
Shift: TShiftState);
begin
if key = 13 then windows.Beep(440, 25);
if key = 32 then windows.Beep(440, 25);
KeyState := ksDown;
end;
procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;
Shift: ShiftState);
begin
if key = 13 then windows.Beep(880, 25);
if key = 32 then windows.Beep(880, 25);
if KeyState = ksDown then inc(Counter);
KeyState := ksUp;
{Form1.} Caption := InttoStr(Counter);
end;
...hoffe mal das geht so, ist aus dem Kopf...