NMFTP控件使用问题

huiwww 2003-11-26 05:13:26
如何使用NMFTP控件列出ftp服务器指定目录下的文件到 memo控件的txt下
谢谢
...全文
40 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
snowmiao2002 2003-11-26
  • 打赏
  • 举报
回复
NMFTP1.list;

procedure TfrmMain.NMFTP1ListItem(Listing: String);
begin
//
memo1.Lines.Add(listing);
end;


Getting a directory list on a remote host:

Once you are connected to the server, you can get a listing of the files and directories there by calling the "List' method, and writing an event handler for the "OnListItem" event.

For each item listed, the OnListItem event is called.
If the ParseList property is set to TRUE, the FTPDirectoryList property will contain the elements for each listing, including name, size, and attributes.
If this command succeeds, the OnSuccess event will be called, otherwise the OnFailure event is called. In either case, cmdList is passed as the Trans_Type parameter in the event.


hongqi162 2003-11-26
  • 打赏
  • 举报
回复
procedure TForm1.Button1Click(Sender: TObject);
var
i : Integer;
ListItem : TListItem;
begin

NMFTP.Connect;
NMFTP.ParseList := True;
NMFTP.List;
for I := 0 to (NMFTP.FTPDirectoryList.Name.Count - 1) do
begin
with NMFTP.FTPDirectoryList do
begin
ListItem := lvFileList.Items.Add;
ListItem.Caption := Name[I]; //这几行改了
ListItem.SubItems.Add(Size[I]); //
ListItem.SubItems.Add(ModifDate[I]); //
ListItem.SubItems.Add(Attribute[I]); //
end;
end;
end;

5,388

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧