1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
| procedure TForm1.VoteButtonClick(Sender: TObject);
var
Ts : TStringList;
PageWeb : string;
begin
Ts := TStringList.Create;
try
Ts.AddStrings(PostMemo.Lines);
IdHTTP1.Request.ContentType := 'application/x-www-form-urlencoded';
PageWeb := IdHTTP1.Post(URL_Edit.Text,Ts);
Memo1.Lines.Add(PageWeb);
except
on e: EIdHTTPProtocolException do
begin
ShowMessage('Rija dit : ' + e.Message + ' ' + IntToStr(e.ReplyErrorCode));
end;
end;
end;
procedure TForm1.IdHTTP1WorkEnd(Sender: TObject; AWorkMode: TWorkMode);
begin
ShowMessage('Vote End - ' + TIdHTTP(Sender).ResponseText + ' ' + TIdHTTP(Sender).URL.Path);
if AWorkMode = wmRead then
CompleteStateLabel.Caption := 'Completed';
end;
procedure TForm1.IdHTTP1Work(Sender: TObject; AWorkMode: TWorkMode;
const AWorkCount: Integer);
begin
if AWorkMode = wmRead then
begin
{Le composant nous renvoit ici quand il travaille}
ProgressBar1.Position := AWorkCount ;
CompleteStateLabel.Caption := IntToStr(AWorkCount) + 'Bytes de :' + inttostr(ProgressBar1.Max) ;
end;
end; |
Partager