Mastodon
Programmierung

EasterEggs

>
> How to capture ALT+T E A M in a about box?
>

Hi … Set the form’s KeyPreview property to True and then write the
following code :

[code lang=”delphi”]var
Form1: TForm1;
Text2 : String; // Global string.

implementation

{$R *.DFM}

procedure TForm1.FormCreate(Sender: TObject);
begin
Text2 := EmptyStr;
end;

procedure TForm1.FormKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if ssAlt in Shift then
begin
if Pos(Text2 + UpCase(Chr(Key)), ‘TEAM’) > 0 then
begin
Text2 := Text2 + UpCase(Chr(Key ));
end
else
begin
Text2 := UpCase(Chr(Key ));
end;
if Text2 = ‘TEAM’ then
begin
Text2 := EmptyStr;
// from here, you can write anything you’d like to be done …
ShowMessage(‘Easter Egg!!’);
end;
end;
end;

end.
[/code]

[tags]Delphi, Misc, Keyboard[/tags]

0 Kommentare zu “EasterEggs

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht.