Does anyone uses FPiette's FTP client? I have it in one of my applications
but when the app is run on a win95/98 machine it nearly always brings up
the illegal operation dialog that the browsers are good at displaying.
IT always happen just as a file is finishing downloading and never happens
on my nt machine. Do you think it would be something in my code, the
component, or a problem with the machine that is causing this dialog to
appear? It happens on all 15 windows machines I can use for testing but
they are all excactly the same because they are ghosted from the same hard
drive.
here is the code doing most of the work for those of you that have the
component and maybe want to test it.
Thank you in advance
James
Function TDownloadform.Downloadfile(Name : string;
Size : Integer
) : Boolean;
Var
LVf: file of Byte;
LVSize : Integer;
LVFilename : String;
LVFtp : TFtpclient;
Begin
Filename := VThisdirectory + CTempdir + Name;
IF Fileexists(Filename) then begin
AssignFile(f, FileName);
Reset(f);
LVSize := FileSize(f);
Closefile(f);
IF Size = LVSize then begin //only let file stay if same size
Result := True;
Exit;
End;
End;
LVFtp := TFtpclient.Create(DownloadForm);
Try
LVFtp.HostName := CFTPServer;
LVFtp.Port := CFTPPort;
LVFtp.UserName := CFTPUserName;
LVFtp.PassWord := CFTPPassWord;
LVFtp.HostDirName := CPath;
LVFtp.HostFileName := Name;
LVFtp.LocalFileName := LVFilename;
LVFtp.OnProgress := Progress;
IF LVFtp.Receive then begin
Result := True;
end else begin
Showmessage('Error downloading file ' + name + #13 +
LVFtp.ErrorMessage);
Result := False;
end;
Finally
LVFtp.Free;
End;
End;
procedure TDownloadForm.Progress(Sender: TObject;
Count: Longint;
var Abort: Boolean);
begin
If BtnCancel.Enabled = False then begin
abort := true;
End else begin
//current file
BarThisFile.Position := Count;
LbSizeSummary.Caption := inttostr(Count) + ' of ' +
inttostr(GVCurrentfilesize);
//total
BarTotal.Position := GVTotaldownloadedsize + Count;
LbTSizeSummary.Caption := inttostr(GVTotaldownloadedsize + Count) +
'of' + inttostr(GVTotalToDownLoad);
End;
//faster with out this but not as nice
Application.ProcessMessages;
end;
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz