Autor Beitrag
the-kecks
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 157
Erhaltene Danke: 1

Windows Vista Home Premium 64Bit
Delphi 7 Ent.
BeitragVerfasst: Mo 20.07.09 23:06 
hi,
ich hab einen account checker für verschiedene websites erstellt. bei vielen accounts, kann das schonmal etwas dauern, da möchte man auch zwischen drin mal unterbrechen können/den vorgang stoppen. meine frage ist nun: wie erstelle ich so einen "Abbrechen" button mit dem man IdHTTP "anhalten" kann?

mfg
R4id
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 28

Win XP Home, Win XP Prof.
D7 Prof., D2006 Arch., BCB2006 Arch.
BeitragVerfasst: Mo 20.07.09 23:14 
Indem du eine Globale Variable vom Type Boolean deklarierst und ab und zu mal den Status von diesem Boolean überprüfst und dem ensprechend handelst, so würds ich zumindest probieren...
the-kecks Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 157
Erhaltene Danke: 1

Windows Vista Home Premium 64Bit
Delphi 7 Ent.
BeitragVerfasst: Di 21.07.09 00:05 
funzt leider nicht, da IdHTTP solange es aktiv ist ähnlich wie eine schleife wirkt. alles andere wird lahmgelegt

mfg
Marc.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1876
Erhaltene Danke: 129

Win 8.1, Xubuntu 15.10

BeitragVerfasst: Di 21.07.09 00:10 
Mein Vorschlag: Lager die Funktion in einen seperaten Thread aus und pausiere (suspend) diesen. Ein Tutorial von user profile iconLuckie dazu findest u.a. hier.

Grüße,
Marc
the-kecks Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 157
Erhaltene Danke: 1

Windows Vista Home Premium 64Bit
Delphi 7 Ent.
BeitragVerfasst: Di 21.07.09 16:53 
hab das ganze mit einem boolean wert gelöst (wie von R4id vorgeschlagen). ich überprüfe ich den wert im OnWork ereignis von IdHTTP und schließe dann ggf. mit "exit;".
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
var
  bAbort : boolean;

...

procedure TForm1.Button5Click(Sender: TObject);
begin
  bAbort:=true;
end;

procedure TForm1.IdHTTP1Work(ASender: TObject; AWorkMode: TWorkMode;
  AWorkCount: Integer);
begin
  if bAbort=true then exit;
end


mfg