Newsgroups : Borland : borland.public.delphi.internet.winsock : 2008 Jun : Console App with Indy10 FTP client - event handlers

www.cryer.info
Managed Newsgroup Archive

Console App with Indy10 FTP client - event handlers

Subject:Console App with Indy10 FTP client - event handlers
Posted by:"millerb" (bcmill..@prairiecomm.net)
Date:Thu, 19 Jun 2008 15:24:28

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

Replies:

www.cryer.info
Managed Newsgroup Archive