unit Friends;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Menus, ExtCtrls, jpeg, StdCtrls, IdBaseComponent, IdComponent,
IdTCPConnection, IdTCPClient, IdFTP, OleCtrls, SHDocVw_TLB, urlMon;
type
TmainForm =
class(TForm)
MainMenu1: TMainMenu;
Connect1: TMenuItem;
World1: TMenuItem;
Hilfe1: TMenuItem;
Connect2: TMenuItem;
N1: TMenuItem;
Beenden1: TMenuItem;
Panel1: TPanel;
Image1: TImage;
text: TEdit;
bsend: TButton;
nicks: TListBox;
ftp: TIdFTP;
chat: TWebBrowser_V1;
Timer: TTimer;
Memo1: TMemo;
OpenDialog1: TOpenDialog;
SaveDialog1: TSaveDialog;
Button1: TButton;
procedure Beenden1Click(Sender: TObject);
procedure Connect2Click(Sender: TObject);
procedure FormClose(Sender: TObject;
var Action: TCloseAction);
procedure TimerTimer(Sender: TObject);
procedure bsendClick(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
mainForm: TmainForm;
implementation
{$R *.dfm}
procedure Delay(dwMilliseconds: Longint);
var
iStart, iStop: DWORD;
begin
iStart := GetTickCount;
repeat
iStop := GetTickCount;
Application.ProcessMessages;
until (iStop - iStart) >= dwMilliseconds;
end;
procedure TmainForm.Beenden1Click(Sender: TObject);
begin
mainForm.Close;
end;
procedure TmainForm.Connect2Click(Sender: TObject);
begin
ftp.Password := '
sag ich nicht ;)';
ftp.Username := '
friendsmain';
ftp.Host := '
friendsmain.fr.funpic.de';
ftp.Connect(true);
chat.Navigate('
friendsmain.funpic.de/chat.txt');
bsend.Enabled := true;
timer.Enabled := true;
end;
procedure TmainForm.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
ftp.Disconnect;
end;
procedure TmainForm.TimerTimer(Sender: TObject);
begin
if ftp.Connected = true
then
begin
chat.Navigate('
friendsmain.funpic.de/chat.txt');
end;
URLDownloadToFile(
nil,pchar('
http://friendsmain.fr.funpic.de/chat.txt'),pchar('
C:\Fainds-Friends\chat.txt'), 0,
nil);
end;
procedure TmainForm.bsendClick(Sender: TObject);
begin
timer.Enabled := false;
with OpenDialog1
do
begin
Memo1.Lines.LoadFromFile('
c:/Fainds-Friends/chat.txt');
end;
Memo1.Lines.Text := Memo1.Lines.Text + #13 + text.Text;
with savedialog1
do
begin
memo1.Lines.SaveToFile('
c:/Fainds-Friends/chat.txt');
end;
ftp.Put('
c:/Fainds-Friends/chat.txt', '
chat.txt');
timer.Enabled := true;
end;
end.