Newsgroups : Borland : borland.public.delphi.internet.winsock : 2008 Jul : How to use TIdFTP.OnWork<...> in a console application???

www.cryer.info
Managed Newsgroup Archive

How to use TIdFTP.OnWork<...> in a console application???

Subject:How to use TIdFTP.OnWork<...> in a console application???
Posted by:"Bo Berglund" (bo.berglu..@telia.com)
Date:Tue, 1 Jul 2008 08:17:20

I am writing an console application that is transfering some data via
FTP and I am using TIdFTP for this. The transfers are OK but I have a
problem in getting the user feedback working during transfers...

The TIdFTP object is created in code when the console application
starts:

  FTP := TIdFTP.Create;

Then I set the events like this:
  FTP.OnWorkBegin := FTPWorkBegin;
  FTP.OnWork := FTPWork;
  FTP.OnWorkEnd := FTPWorkEnd;

The procedures are defined like this:

procedure FTPWorkBegin(Sender: TObject; AWorkMode: TWorkMode;    const
AWorkCountMax: Integer);

procedure FTPWork(Sender: TObject; AWorkMode: TWorkMode; const
AWorkCount: Integer);

procedure FTPWorkEnd(Sender: TObject; AWorkMode: TWorkMode);

The idea is to use these events to write a percent done message on the
standard output using the datya supplied by the event.

But the code won't compile, it stops and gives the error:

"[Error] Xmltv2Mei.dpr(790): Incompatible types: 'method pointer and
regular procedure'"

I *have* used this before in a GUI application so I am now baffled as
to why it won't work in a console app when everything else works just
fine.

Any ideas about what I can do to fix this???
(I cannot change the application around to a GUI app because of the
way it is going to be executed)

I am using Delphi 7 and the Indy 10 snapshot from about 1 month ago.


/BoB

Replies:

www.cryer.info
Managed Newsgroup Archive