procedure TForm1.FtpListDirectory(ASender: TIdFTPServerThread;
const APath: String; ADirectoryListing: TIdFTPListItems);
var
fi:WIN32_FIND_DATA;
h:integer;
begin
ADirectoryListing.ListFormat:=flfDos;
ASender.CurrentDir:=path;
h:=FindFirstFile(pchar(path+'*.*'),fi);
while h<>-1 do
begin
if not IsDirNotation(path+fi.cFileName) then
begin
if fi.dwFileAttributes and FILE_ATTRIBUTE_DIRECTORY<>FILE_ATTRIBUTE_DIRECTORY then
with ADirectoryListing.Add do
begin
ItemType:=ditFile;
FileName:=fi.cFileName;
Size:=fi.nFileSizeLow;
ModifiedDate:=now;
end
else
with ADirectoryListing.Add do
begin
ItemType:=ditDirectory;
FileName:=fi.cFileName;
Size:=fi.nFileSizeLow;
ModifiedDate:=now;
end;
end;
if not FindNextFile(h,fi) then
h:=-1;
end;
end;
procedure TForm1.FtpGetFileSize(ASender: TIdFTPServerThread;
const AFilename: String; var VFileSize: Int64);
var
h:dword;
begin
h:=CreateFile(pchar(AFilename),GENERIC_READ,FILE_SHARE_READ,nil,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,0);
VFileSize:=GetFileSize(h,nil);
CloseHandle(h);
end;
procedure TForm1.FtpChangeDirectory(ASender: TIdFTPServerThread;
var VDirectory: String);
begin
ASender.CurrentDir := VDirectory;
end;
procedure TForm1.FtpRetrieveFile(ASender: TIdFTPServerThread;
const AFileName: String; var VStream: TStream);
begin
VStream := TFileStream.Create(AFileName,fmShareDenyNone or fmOpenRead);
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
ftp.Threads.Clear;
end;
就是这些了,, 用flashget拉, 只有一个线程., 多开也拉不了.