3
Well, I did a job, but it’s not working.
The purpose of this function is to download a file and when finished, return true
.
This is the function:
function TForm1.BaixarArquivo(Sender: TObject; Url:String; Name:Integer):Boolean;
var
fileTD : TFileStream;
begin
fileTD := TFileStream.Create(IntToStr(Name) + ExtractFileExt(Url), fmCreate);
try
Sender.Get(Url, FileTD);
finally
FreeAndNil(fileTD);
end;
end;
I declared so in the public:
function BaixarArquivo(Sender: TObject; Url:string; Name:Integer): Boolean;
And I called it that:
BaixarArquivo(IdHTTP1, 'http://pokestage.ddns.net/patch/5.rar', 5);
But returns this error:
[Error] Launcherunit.pas(66): Undeclared Identifier: 'Get'
Second function:
function TForm1.RetornaPorcentagem(ValorMaximo, ValorAtual: Real):string;
var
resultado: Real;
begin
resultado := ((ValorAtual * 100) / ValorMaximo); Result := FormatFloat('0%', resultado);
end;
The error is from Floating Division by Zero.
The topic @Tiagosilva spoke about is this one.
– emanuelsn