unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ICQClient, ICQWorks, ExtCtrls;
type
TForm1 =
class(TForm)
ICQClient1: TICQClient;
Label1: TLabel;
OpenDialog1: TOpenDialog;
Button1: TButton;
edFile: TLabeledEdit;
btnLogIn: TButton;
edOnline: TEdit;
procedure Button1Click(Sender: TObject);
procedure btnLogInClick(Sender: TObject);
procedure ICQClient1Login(Sender: TObject);
procedure ICQClient1SendFileStart(Sender: TObject; UIN: Cardinal;
SendFileRec: TSendFileRec);
procedure ICQClient1SendFileData(Sender: TObject; UIN: Cardinal;
Data: Pointer;
var DataLen: Cardinal;
var IsLastPacket: Boolean);
procedure ICQClient1OnlineInfo(Sender: TObject; UIN:
String;
Port: Word; InternalIP, ExternalIP:
String; OnlineTime: TDateTime;
Idle: Word; ICQVersion, MirandaVersion: Cardinal; ProtoVer,
UserCaps: Byte);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
SendStream: TFileStream;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
FileName:
string;
begin
if OpenDialog1.Execute
then begin
FileName:=OpenDialog1.FileName;
edFile.Text:=OpenDialog1.FileName;
ICQClient1.SendFileDC(95369854, FileName, '
Testing SendFileDC');
End;
end;
procedure TForm1.btnLogInClick(Sender: TObject);
begin
ICQClient1.Login;
ICQClient1.AddContactVisible(95369854);
end;
procedure TForm1.ICQClient1Login(Sender: TObject);
begin
Label1.Caption:=StatusToStr(ICQClient1.Status);
end;
procedure TForm1.ICQClient1SendFileStart(Sender: TObject; UIN: Cardinal;
SendFileRec: TSendFileRec);
Begin
If SendStream <>
nil then
FreeAndNil(SendStream);
// can only proccess one send at a time with this code.
// Open File For Reading.
SendStream := TFileStream.Create(SendFileRec.FilePath + SendFileRec.FileName, fmOpenRead);
End;
procedure TForm1.ICQClient1SendFileData(Sender: TObject; UIN: Cardinal;
Data: Pointer;
var DataLen: Cardinal;
var IsLastPacket: Boolean);
begin
// Read 2048 bytes into Data Buffer.
DataLen := SendStream.
Read(Data, 2048);
// Are we at the end of the file?
IsLastPacket := SendStream.Position = SendStream.Size;
end;