Bonjour,
J'utilise le composant TIdHTTP de manière dynamique comme ceci :
Je voudrais rajouter un paramètre à ma fonction HTTPWorkBegin comme ceci :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 procedure TFGCenter.Telecharger(Lien:string;Fichier:TStream); var Waiting : TWaiting; HTTP : TIdHTTP; begin try Waiting := TWaiting.Create(nil); Waiting.LInformations.Caption := 'Transfert du fichier ' + ExtractFileNameFromUrl(Lien) + ' en cours...'; Waiting.Show; Waiting.Refresh; try HTTP := TIdHTTP.Create(Self); HTTP.ProxyParams.ProxyServer := '217.x.x.x'; HTTP.ProxyParams.ProxyPort := 80; HTTP.OnWorkBegin := HTTPWorkBegin; HTTP.Get (Lien,Fichier); finally HTTP.Free; end; Waiting.Free; except on E : Exception do begin Log(E.Message); end; end; end;
Je déclare ma fonction comme ça :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9 procedure TFGcenter.HTTPWorkBegin(Sender: TObject; AWorkMode: TWorkMode; const AWorkCountMax: Integer; Waiting:TWaiting); begin if AWorkMode = wmRead then begin Waiting.ProgressBarInformations.Max := AWorkCountMax; Waiting.ProgressBarInformations.Position := 0; end; end;
Cependant, si je fais comme ça, j'ai l'erreur suivante :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 procedure HTTPWorkBegin(Sender: TObject; AWorkMode: TWorkMode; const AWorkCountMax: Integer; Waiting:TWaiting);
Comment dois-je faire ?[Pascal Erreur] xxxx.pas(197): E2009 Types incompatibles : 'Les listes de paramètres diffèrent'
Merci,
ZiP
Partager