L
ljxhbsc
Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TFormMain.ViewList;
var
DirList:TStringList;
i:Integer;
ListItem:TListItem;
Attribute:TIdDirItemType;
begin
DirList:=TStringList.Create;
try
try
IdFTP1.List(DirList);
except;
end;
finally
DirList.Free;
end;
ListViewRemote.Clear;
for i:=0 to IdFTP1.DirectoryListing.Count-1 do
begin
ListItem:=ListViewRemote.Items.Add();
ListItem.Caption:=IdFTP1.DirectoryListing.FileName;
ListItem.SubItems.Add(IntToStr(IdFTP1.DirectoryListing.Size));
ListItem.SubItems.Add(DateTOStr(IdFTP1.DirectoryListing.ModifiedDate));
Attribute:=IdFTP1.DirectoryListing.ItemType;
if Attribute=ditDirectory then
begin ListItem.SubItems.Add('目录');
ListItem.ImageIndex:=0 end;
else if Attribute=ditFile then
begin
ListItem.SubItems.Add('文件');
ListItem.ImageIndex:=1 end
else if Attribute=ditSymbolicLink then begin
ListItem.SubItems.Add('符号连接');
ListItem.ImageIndex:=2
end;
end;
Attribute:TIdDirItemType; 定义这个的时候老是在这报错 找人指导哈
var
DirList:TStringList;
i:Integer;
ListItem:TListItem;
Attribute:TIdDirItemType;
begin
DirList:=TStringList.Create;
try
try
IdFTP1.List(DirList);
except;
end;
finally
DirList.Free;
end;
ListViewRemote.Clear;
for i:=0 to IdFTP1.DirectoryListing.Count-1 do
begin
ListItem:=ListViewRemote.Items.Add();
ListItem.Caption:=IdFTP1.DirectoryListing.FileName;
ListItem.SubItems.Add(IntToStr(IdFTP1.DirectoryListing.Size));
ListItem.SubItems.Add(DateTOStr(IdFTP1.DirectoryListing.ModifiedDate));
Attribute:=IdFTP1.DirectoryListing.ItemType;
if Attribute=ditDirectory then
begin ListItem.SubItems.Add('目录');
ListItem.ImageIndex:=0 end;
else if Attribute=ditFile then
begin
ListItem.SubItems.Add('文件');
ListItem.ImageIndex:=1 end
else if Attribute=ditSymbolicLink then begin
ListItem.SubItems.Add('符号连接');
ListItem.ImageIndex:=2
end;
end;
Attribute:TIdDirItemType; 定义这个的时候老是在这报错 找人指导哈