initial commit
[rofl0r-KOL.git] / units / indy / indy_whois_demo / Unit1.pas
blob7a92260924127bc16ab642b91bcc191e2c1bcbf7
1 { KOL MCK } // Do not remove this line!
2 {$DEFINE KOL_MCK}
3 unit Unit1;
5 interface
7 {$IFDEF KOL_MCK}
8 uses Windows, Messages, ShellAPI, KOL {$IFNDEF KOL_MCK}, mirror, Classes,
9 mckCtrls, Controls {$ENDIF},IdBaseComponent, IdComponent,
10 IdTCPConnection, IdTCPClient, IdWhois;
11 {$ELSE}
12 {$I uses.inc}
13 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
14 mirror;
15 {$ENDIF}
17 type
18 {$IFDEF KOL_MCK}
19 {$I MCKfakeClasses.inc}
20 PForm1 = ^TForm1;
21 TForm1 = object(TObj)
22 Form: PControl;
23 {$ELSE not_KOL_MCK}
24 TForm1 = class(TForm)
25 {$ENDIF KOL_MCK}
26 KOLProject1: TKOLProject;
27 KOLForm1: TKOLForm;
28 btLookup: TKOLButton;
29 edDomain: TKOLEditBox;
30 meResults: TKOLMemo;
31 Label1: TKOLLabel;
32 procedure KOLForm1FormCreate(Sender: PObj);
33 procedure btLookupClickClick(Sender: PObj);
34 procedure edDomainKeyDown(Sender: PControl; var Key: Integer;
35 Shift: Cardinal);
36 private
37 { Private declarations }
38 public
39 { Public declarations }
40 end;
42 var
43 Form1 {$IFDEF KOL_MCK} : PForm1 {$ELSE} : TForm1 {$ENDIF} ;
44 IdWhoIs1:PIdWhoIs;
46 {$IFDEF KOL_MCK}
47 procedure NewForm1( var Result: PForm1; AParent: PControl );
48 {$ENDIF}
50 implementation
52 {$IFNDEF KOL_MCK} {$R *.DFM} {$ENDIF}
54 {$IFDEF KOL_MCK}
55 {$I Unit1_1.inc}
56 {$ENDIF}
58 procedure TForm1.KOLForm1FormCreate(Sender: PObj);
59 begin
60 IdWhoIs1:=NewIdWhoIs(nil);
61 end;
63 procedure TForm1.btLookupClickClick(Sender: PObj);
64 var
65 ALine,
66 AResult: string;
67 iPos: Integer;
69 begin
70 meResults.Clear;
71 AResult := IdWhoIs1.WhoIs(edDomain.Text);
72 while Length(AResult) > 0 do
73 begin
74 iPos := Pos(#10, AResult);
75 if iPos = 1 then
76 begin
77 Delete(AResult, 1, 1);
78 end
79 else
80 begin
81 ALine := Copy(AResult, 1, iPos - 1);
82 meResults.Add(ALine+#13#10);
83 Delete(AResult, 1, Length(ALine));
84 end;
85 end;
86 end;
88 procedure TForm1.edDomainKeyDown(Sender: PControl; var Key: Integer;
89 Shift: Cardinal);
90 begin
91 if Key = 13 then
92 btLookup.OnClick(@Self);
93 end;
95 end.