uses mmsystem;
procedure Telegraf(lbl: TLabel; Txt: string; pause: integer; ton: boolean);
var
x: integer;
begin
lbl.caption := '';
for x := 1 to length(Txt) do begin
lbl.caption := lbl.caption + Txt[x];
if Txt[x] <> #32 then begin
if ton then
playsound('c:\ding.wav', 0, SND_FILENAME or SND_ASYNC);
Application.ProcessMessages;
if Application.terminated then exit;
sleep(pause);
end;
end;
end;
// Beispielaufruf
procedure TForm1.Button6Click(Sender: TObject);
begin
Telegraf(Label1, 'Das ist ein Test für den Telegrafen-Code!', 180, true);
end;