Morse code is a method of coding messages into long and short beeps, often transmitted using continuous wave.
This is the first entry to the Fancy Delphi Application Contest
Delphi Morse Box
This little fabulous (useless) application will play Morse codes as you type character into a console-looking window.First, letters are "turned" into morse codes using an array of strings:
var MorseArray: array ['a'..'z'] of string;Next, as you type into the windows, the OnKeyPress event plays morse tones through your computer speakerphone:
...
procedure TfrmMorseBox.FormCreate(Sender: TObject) ;
begin
MorseArray['a']:='.-';
MorseArray['b']:='-...';
...
MorseArray['z']:='--..';
end;
procedure TfrmMorseBox.memoMorseKeyPress(Sender: TObject; var Key: Char) ;Yes! Morse codes using Beep. That simple!!
var
s: String;
Morse: String;
j: integer;
begin
s:=lowercase(Key) ;
if (s>='a') and (s<='z') Then begin
Morse:=MorseArray[s[1]];
for j := 1 to Length(Morse) do begin
if Morse[j]='.' Then begin
Windows.Beep(1206,MORSE_UNIT+random(MORSE_GROOVE))
end else begin
Windows.Beep(1200,MORSE_UNIT*3+random(MORSE_GROOVE*3))
end;
Sleep(MORSE_UNIT*3+random(MORSE_GROOVE*3)) ;
end;
end else begin
if s=' ' Then begin
Sleep(MORSE_UNIT*7+random(MORSE_GROOVE*7)) ;
end;
end;
end;
Morse box was submitted by "JoshyFun".
Do you have a FDA(C)? Submit your Delphi code to the Fancy Delphi Application Contest.


