Hi Theo,
I try everything and searching with google but the result is pffffffff

Here is my full unit code, if you have a lot of time correct it, please:)

.
I like write a program that download setup.exe via http and drawing

a progressbar.
I have 3 errors...
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
StdCtrls, ExtCtrls, Buttons, ComCtrls, ExtDlgs, EditBtn, FileCtrl,
httpsend,blcksock,typinfo, synamisc;
type
{ TForm1 }
TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
lblout: TLabel;
Lblin: TLabel;
Memo2: TMemo;
ProgressBar1: TProgressBar;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure ProgressBar1ContextPopup(Sender: TObject; MousePos: TPoint;
var Handled: Boolean);
private
{ private declarations }
public
{ public declarations }
end;
var
Form1: TForm1;
SizeIn,SizeOut: integer;
implementation
{ TForm1 }
type
THookSocketStatus = procedure(Sender: TObject; Reason: THookSocketReason;
const Value: string) of object;
TMemory=pointer;
callback = class
class procedure Status (Sender: TObject; Reason: THookSocketReason;
const Value: String);
class procedure Monitor (Sender: TObject; Writing: Boolean; const
Buffer: TMemory; Len: Integer);
end;
class procedure callback.Status(Sender: TObject; Reason: THookSocketReason;
const Value: String);
var v: String;
begin
v := getEnumName (typeinfo(THookSocketReason), integer(Reason)) + ' ' +
Value;
Form1.Memo2.Lines.Add(v);
if (reason=hr_readcount) then begin
inc(SizeIN,StrToInt64Def(Value,0));
// ProgressBar1.Position := Round(1000 * (CurrentBytes / TotalBytes));
end;
if (reason=hr_writecount) then
inc(SizeOUT,StrToInt64Def(Value,0));
Form1.lblIN.Caption :=inttostr(SizeIN);
Form1.lblOUT.Caption:=inttostr(SizeOUT);
application.ProcessMessages;
end;
class procedure callback.Monitor (Sender: TObject; Writing: Boolean; const
Buffer: TMemory; Len: Integer);
begin
if not writing then
inc(SizeIN, Len)
else
inc(SizeOUT, Len);
Form1.lblIN.Caption :=inttostr(SizeIN);
Form1.lblOUT.Caption:=inttostr(SizeOUT);
application.ProcessMessages;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
HTTP: THTTPSend;
F: TFileStream;
Start,Size: integer;
begin
SizeIN:=0;
SizeOUT:=0;
Memo2.Lines.Add(CRLF+'GET');
Memo2.Lines.Add('------------');
Size:=HttpGetFileSize(Edit1.text); /// ???
HTTP := THTTPSend.Create;
HTTP.Sock.OnStatus := callback.Status;
//or
HTTP.Sock.OnMonitor := callback.Monitor;
F:=TFileStream.Create('hl.exe',fmcreate);
HttpGetBinary('http://.../upgrade.exe',F);
F.Free;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
end;
procedure TForm1.ProgressBar1ContextPopup(Sender: TObject; MousePos: TPoint;
var Handled: Boolean);
begin
end;
initialization
{$I unit1.lrs}
end.