unit jc;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, Buttons, IdBaseComponent,
IdComponent, IdTCPConnection, IdTCPClient, IdHTTP;
type
TForm1 =
class(TForm)
ListBox1: TListBox;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
Label1: TLabel;
Memo1: TMemo;
Timer1: TTimer;
IdHTTP1: TIdHTTP;
procedure FormCreate(Sender: TObject);
procedure ListBox1DrawItem(Control: TWinControl;
Index: Integer;
Rect: TRect; State: TOwnerDrawState);
procedure BitBtn1Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
Apppfad,Juser:
String;
Index: Integer;
implementation
uses Unit2;
{$R *.dfm}
procedure ZeileFaerben(Zeile:integer;Farbe:integer;Listbox:TListbox;
Index:Integer;Rect:TRect);
begin
if Index<>Zeile
then
Farbe:=clBlack;
Listbox.Canvas.Brush.Color:=clWindow;
Listbox.Canvas.Pen.Color:=Farbe;
Listbox.Canvas.FillRect(Rect);
Listbox.Canvas.Font.Color:=Farbe;
Listbox.Canvas.TextOut(Rect.Left,Rect.Top,Listbox.Items[
Index]);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Apppfad := ExtractFilePath(Application.ExeName);
if FileExists(Apppfad+'
freunde.dat')
Then
Listbox1.Items.LoadFromFile(Apppfad+'
freunde.dat')
else
ListBox1.Items.SaveToFile(Apppfad+'
freunde.dat');
end;
procedure TForm1.ListBox1DrawItem(Control: TWinControl;
Index: Integer;
Rect: TRect; State: TOwnerDrawState);
begin
Juser := ListBox1.Items[
Index];
Memo1.Text:= IdHttp1.Get('
http://www.jappy.de/user/'+Juser);
if Pos ('
<a href="/line/start/'+Juser+'
" target="' , Memo1.Text) <> 0
then
ZeileFaerben(
Index,ClGreen,Listbox1,
Index,Rect)
else
ZeileFaerben(
Index,ClRed,Listbox1,
Index,Rect);
end;
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
Form2.Show;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
Listbox1.Clear;
Listbox1.Items.LoadFromFile(Apppfad+'
freunde.dat');
end;
end.