millerb
2008-06-19 20:24:28 UTC
Hi Folks,
'Fraid I'm out of my depth here . . .
Need to build a console app to run invisibly using Indy's TIdFTP - to
download a file. (Got it working in a Form app)
I'd like to make use of the TIdFTP event handlers but don't know how to
set it up in a formless app. Here's the gist of it:
***************************
program AutoDownload;
//{$APPTYPE CONSOLE}
uses
SysUtils, IdFTP;
var
FTP: TIdFTP;
strm: TStringStream;
procedure FTPAfterClientLogin;
procedure FTPAfterGet;
procedure Main;
begin
FTP := TIdFTP.Create(nil);
FTP.OnAfterClientLogin := FTPAfterClientLogin;
FTP.OnAfterGet := FTPAfterGet;
FTP.Connect;
end;
procedure FTPAfterClientLogin;
var logNam;
begin
logNam := ...
...
try
strm := TStringStream.Create(s);
FTP.Get(logNam,strm,true);
finally
strm.Free;
end;
...
end;
procedure FTPAfterGet;
begin
...
end;
***************************
With the above code I'm getting this message:
E2009 Incompatible types: 'method pointer and regular procedure'
I've seen the stuff in Delphi 2005 Help on method pointers but haven't
been able to figure it out.
Suggestions/Examples appreciated.
Barry
'Fraid I'm out of my depth here . . .
Need to build a console app to run invisibly using Indy's TIdFTP - to
download a file. (Got it working in a Form app)
I'd like to make use of the TIdFTP event handlers but don't know how to
set it up in a formless app. Here's the gist of it:
***************************
program AutoDownload;
//{$APPTYPE CONSOLE}
uses
SysUtils, IdFTP;
var
FTP: TIdFTP;
strm: TStringStream;
procedure FTPAfterClientLogin;
procedure FTPAfterGet;
procedure Main;
begin
FTP := TIdFTP.Create(nil);
FTP.OnAfterClientLogin := FTPAfterClientLogin;
FTP.OnAfterGet := FTPAfterGet;
FTP.Connect;
end;
procedure FTPAfterClientLogin;
var logNam;
begin
logNam := ...
...
try
strm := TStringStream.Create(s);
FTP.Get(logNam,strm,true);
finally
strm.Free;
end;
...
end;
procedure FTPAfterGet;
begin
...
end;
***************************
With the above code I'm getting this message:
E2009 Incompatible types: 'method pointer and regular procedure'
I've seen the stuff in Delphi 2005 Help on method pointers but haven't
been able to figure it out.
Suggestions/Examples appreciated.
Barry