出现的错误提示是:project project1.exe raised exception class EAcessViolation with message 'Acess violation at address 004042E6 in moudle 'project1.exe'. Read of address 0069006C'. process stopped. Use Step or Run to continu.很头疼的错误啊!!
这样试试,如果不行,呵呵,可以接着哭 ^_^procedure TForm1.Button1Click(Sender: TObject); begin if NMFTP1.Connected then begin Memo1.Clear; NMFTP1.Nlist; end; end;procedure TForm1.NMFTP1ListItem(Listing: String); begin memo1.Lines.Append(Listing); if memo1.Lines.Count>0 then begin try NMFTP1.Download(Memo1.Lines[0],'c:\'+Memo1.Lines[0]); Memo1.Lines.Delete(0); Except end; end; end;
不会吧,我就这么做的呀,没有问题哦 下面的差不多就是我的源码,只不过我省去了一些判断语句和相关处理而已,与功能没有关系procedure TForm1.Button1Click(Sender: TObject); var i:integer; begin if NMFTP1.Connected then begin Memo1.Clear; NMFTP1.Nlist; if memo1.Lines.Count>0 then for i:=0 to memo1.lines.count-1 do begin try NMFTP1.Download(Memo1.Lines[i],'c:\'+Memo1.Lines[i]);
Except end; end; end; end;procedure TForm1.NMFTP1ListItem(Listing: String); begin memo1.Lines.Append(Listing);
Applies to TNMFTP componentDeclaration property OnListItem: TNMListItem;Description The OnListItem event is called when a directory listing is taking place. This event is called once for each item that gets listed.Event Parameters: The Listing parameter is the item being currently listed.Notes: This event gets called by the List and NList methods.
begin
Ftp.Vendor := 1;
Ftp.Host := '.....';
Ftp.UserID := '...';
Ftp.Password := '...';
Ftp.Connect; Ftp.ChangeDir('\database');
Ftp.NList;
Ftp.Mode(MODE_ASCII);
end;procedure TForm1.FTPListItem(Listing: String);
begin
Ftp.DownLoad(Listing, Listing);
end;
begin
if NMFTP1.Connected then
begin
Memo1.Clear;
NMFTP1.Nlist;
end;
end;procedure TForm1.NMFTP1ListItem(Listing: String);
begin
memo1.Lines.Append(Listing);
if memo1.Lines.Count>0 then
begin
try
NMFTP1.Download(Memo1.Lines[0],'c:\'+Memo1.Lines[0]);
Memo1.Lines.Delete(0);
Except
end;
end;
end;
下面的差不多就是我的源码,只不过我省去了一些判断语句和相关处理而已,与功能没有关系procedure TForm1.Button1Click(Sender: TObject);
var i:integer;
begin
if NMFTP1.Connected then
begin
Memo1.Clear;
NMFTP1.Nlist;
if memo1.Lines.Count>0 then
for i:=0 to memo1.lines.count-1 do
begin
try
NMFTP1.Download(Memo1.Lines[i],'c:\'+Memo1.Lines[i]);
Except
end;
end;
end;
end;procedure TForm1.NMFTP1ListItem(Listing: String);
begin
memo1.Lines.Append(Listing);
end;
将listing 保存到字符串列表中,然后遍历下载!!!
TNMFTP componentDeclaration
property OnListItem: TNMListItem;Description
The OnListItem event is called when a directory listing is taking place. This event is called once for each item that gets listed.Event Parameters:
The Listing parameter is the item being currently listed.Notes:
This event gets called by the List and NList methods.