Home > Back-end >  Delphi xe run the following code below, the following error, ask for help
Delphi xe run the following code below, the following error, ask for help

Time:04-17

Run the following code from, appear the following error

[dcc32 Error] Unit1. Pas (46) : E2003 Undeclared identifier: 'Text'
[dcc32 Error] Unit1. Pas (48) : E2003 Undeclared identifier: 'OwnerName
[dcc32 Error] Unit1. Pas (48) : E2003 Undeclared identifier: 'GroupName'
[dcc32 Error] Unit1. Pas (48) : E2008 Incompatible types
[dcc32 Error] Unit1. Pas (48) : E2003 Undeclared identifier: 'LinkedItemName'
[dcc32 Error] Unit1. Pas (48) : E2250 There is no overloaded version of 'ShowMessage' that can be called with these arguments
[dcc32 Fatal Error] Project1. DPR (5) : F2063 Could not compile, informs the unit 'Unit1. Pas'
Failed
Elapsed time: 00:00:00. 6





Procedure TForm1. Button2Click (Sender: TObject);
Var
Tt: TIdFTPListItems;
T: TIdFTPListItem;
I: integer;
Tfname: String;
The begin//download
Label1. Caption:=IdFTP1. The DirectoryListing. Items [0]. The FileName.
IdFTP1. TransferType:=ftBinary;//specified as binary or text file ftASCII
For I:=0 to IdFTP1. The DirectoryListing. Do the Count - 1
The begin
Tt:=IdFTP1. The DirectoryListing;//get the current directory files and directory list
T:=tt. The Items [I];//to get information about a file
Label1. Caption:=t.T ext.//remove a file information content
Tfname:=t.F ileName;
Showmessage (t.O wnerName + "+ t.G roupName +" + t.F ileName + "+ t.L inkedItemName);
If IdFTP1. The DirectoryListing. Items [I] ItemType=ditFile then//if the file is
The begin
IdFTP1. Get (tfname, 'd: \ FTPtest \' + tfname, True, True);//downloaded to the local and coverage, and support breakpoint continuingly
end;
end;
end;

CodePudding user response:

This program should be written in the Delphi7,
Delphi7 Indy version is 9 Indy, and at present, most of the Delphi version with Indy10 have many differences, adaptability to change:

 procedure TForm1. Button2Click (Sender: TObject); 
Var
Tt: TIdFTPListItems;
T: TIdFTPListItem;
I: integer;
Tfname: String;
The begin//download
//Label1. Caption:=IdFTP1. The DirectoryListing. Items [0]. The FileName.
IdFTP1. TransferType:=ftBinary;//specified as binary or text file ftASCII
For I:=0 to IdFTP1. The DirectoryListing. Do the Count - 1
The begin
Tt:=IdFTP1. The DirectoryListing;//get the current directory files and directory list
T:=tt. The Items [I];//to get information about a file
//Label1. Caption:=t.T ext.//remove a file information content
Tfname:=t.F ileName;
//showmessage (t.O wnerName + "+ t.G roupName +" + t.F ileName + "+ t.L inkedItemName);
If IdFTP1. The DirectoryListing. Items [I] ItemType=ditFile then//if the file is
The begin
IdFTP1. Get (tfname ExtractFilePath (Application. ExeName) + tfname, True, True);//downloaded to the local and coverage, and support breakpoint continuingly
end;
end;
end;

  • Related