FTP ActiveX in Delphi 3 Pro

I'm having a problem using the FTP ActiveX control in Delphi 3 Pro.
I've managed to connect and download a file but I get an EFOpenError in this section of code when I try to load the file into the memo control. I can see the file on the desktop and I can open it with Notepad, so what's going on.

procedure TfrmTest.FTP1DocOutput(Sender: TObject;
  const DocOutput: DocOutput);
begin
  case DocOutput.State of
    icDocEnd:
    begin
      memo1.Lines.LoadFromFile('c:\windows\desktop\V.txt');
    end;
  end;
end;

everyone's thoughts are appreciated, I can up the points if required.
elkiorsAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
new_xConnect With a Mentor Commented:
Hi ,

 Long time passed;
0
 
MotazCommented:
Listening..
0
 
new_xCommented:
In fact LoadFromFile simply calls the
TFilestream constructor with the arguments
  TFileStream.Create(FileName, fmOpenRead or fmShareDenywrite);

if you get exception from this call
this means that whether you supplied an invalid filename (there is no file by that name.) or the file could not be opened with fmShareDenywrite mode constant.

(PS: I recommend that you use FPiette ' s ICS components which also includes ftp component which is not an ActiveX, full source code and sample programs available www.rtfm.be/fpiette/indexuk.htm)


Regards,

0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
elkiorsAuthor Commented:
Adjusted points to 100
0
 
elkiorsAuthor Commented:
new-x:

thanks for the link, is there any way I can get around my problem using the default component. One thing that puzzled me was that LoadFromFile doesn't throw the error if I add a showmessage(''); just before it. which would indicate a timing problem, however if I add a Sleep(5000) just before it, the error still occurs. How would I open the file with different access rights ? I can get away with just loading into a TStringList if the solution is easier that way.

BTW I've doubled the points.

regards

Darren
0
 
new_xCommented:
Hi,

 delete the Memo1.Lines.LoadFromfile statement and put these lines(before doing that declare FHandle variable as
 FHandle: THAndle;
)

     
FHandle:= CreateFile(
PChar('c:\windows\desktop\V.txt'),    GENERIC_READ,
FILE_SHARE_READ or FILE_SHARE_WRITE, nil,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, 0);

if(FHandle<>INVALID_HANDLE_VALUE) then begin
      ShowMessage('SUCCESS');
      CloseHandle(FHandle);
end
else
      ShowMessage('FAILURE');


Regards,
0
 
new_xCommented:
Hi,

 delete the Memo1.Lines.LoadFromfile statement and put these lines(before doing that declare FHandle variable as
 FHandle: THAndle;
)

     
FHandle:= CreateFile(
PChar('c:\windows\desktop\V.txt'),    GENERIC_READ,
FILE_SHARE_READ or FILE_SHARE_WRITE, nil,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, 0);

if(FHandle<>INVALID_HANDLE_VALUE) then begin
      ShowMessage('SUCCESS');
      CloseHandle(FHandle);
end
else
      ShowMessage('FAILURE');


Regards,
0
 
new_xCommented:
Let me know the result (whether SUCCESS or FAILURE)
0
 
elkiorsAuthor Commented:
Hi,

thanks for getting back, unfortunately, I downloaded the ICS suite as you suggested, and I got the FTP client in that suite working first time! however I unwittingly overwrote my original test project for the activex version, however I will reconstruct it in the name of research, you'll have to bear with me for a few days though as I've just bought myself the bits for a new machine, this P150 has got a little two long in the tooth. the points will be yours if I get a SUCCESS. If I get a FAILURE you'll still get the points for passing me the link for the ICS, it's excellent. I'll let you know the outcome.

Kindest regards

Darren
0
 
new_xCommented:
by using Fpiette's component you did the right thing :-), I have been using his components for two years. He also has a mailing list, If you have further questions I recommend you subscribe the list. Using ActiveX has disadvantages. (You have to load and register the activex for every computer that uses your program)

Regards,
0
 
elkiorsAuthor Commented:
Hi new_x

Just got my email back up and running, so responded straight away.

I'm really sorry it's taken so long for me to get back round to this, I've had to rebuild my new system TWICE. W98 sucks at times :-(

Having done all that I haven't had a chance to recreate my original test and therefore have'nt tried to implement your coding work-around for the bundled FTP client, however your info for the link to the ICS suite of components has proved a perfect solution so the points are yours. Please accept my apologies for not acting on your coding ... a bit low-level for me to fully appreciate, but that's my fault not yours.

Thanx again for all your help and tips.

Regards

Darren
0
 
new_xCommented:

Thnx for the points,

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.