Autor Beitrag
Novo
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 90

Win XP, Win 7
Delphi 7 Enterprise, Delphi 2009
BeitragVerfasst: So 07.10.07 14:16 
Ich habe ein Projekt hier:
www.delphi-forum.de/viewtopic.php?p=465623
Sourcecode zum Nachvollziehen gibts im Link oben!
Dazu habe ich ein paar fragen:

Wie kann ich:

- mit der Indy 10 komponente
2 Links gleichzeitig downloaden?
Dazu müsste ich es in Threads auslagern und die weinzeln aufrufen.
ich weiss aber nicht wie, und SuFu hab ich benutzt, aber das war mir zu kompliziert erklärt dort



greez novo
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mo 08.10.07 00:47 
Moin!

user profile iconNovo hat folgendes geschrieben:
Dazu müsste ich es in Threads auslagern und die weinzeln aufrufen.

Wir haben in der Lib ein Tutorial zum Thema Threads und hier ist noch ein anderes Beispiel dazu. :les: ;)

user profile iconNovo hat folgendes geschrieben:
ich weiss aber nicht wie, und SuFu hab ich benutzt, aber das war mir zu kompliziert erklärt dort

Wenn du damit nicht weiter kommst, solltest du in Erwägung ziehen, dass das Thema Threads noch etwas mehr Einsatz von dir verlangt. :nixweiss:

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
JayEff
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2971

Windows Vista Ultimate
D7 Enterprise
BeitragVerfasst: Mo 08.10.07 00:59 
www.michael-puff.de/...er/Delphi/Tutorials/
bringt
Zitat:
No input file specified.

:(

_________________
>+++[>+++[>++++++++<-]<-]<++++[>++++[>>>+++++++<<<-]<-]<<++
[>++[>++[>>++++<<-]<-]<-]>>>>>++++++++++++++++++.+++++++.>++.-.<<.>>--.<+++++..<+.
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mo 08.10.07 01:04 
Moin!

Hab den Link korrigiert.

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
alzaimar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2889
Erhaltene Danke: 13

W2000, XP
D6E, BDS2006A, DevExpress
BeitragVerfasst: Mo 08.10.07 07:18 
In dr Delphi-Praxis habe ich einen Threadpool vorgestellt, der die Arbeit mit Threads stark vereinfacht. Du musst nur noch den Job definieren, der im Hintergrund ausgeführt werden soll.

ausblenden volle Höhe Delphi-Quelltext
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:
Type
  TDownLoadJob = Class (TWorkerThreadJob)
  Private
    ... // Indie-Komponenten 
    fDownloadURL : String;
  Protected
    Procedure Execute(aThread: TWorkerThread);
  Public
    Constructor Create (aDownloadURL : String);
    Destructor Destroy; Override;
  End;

Constructor TDownloadJob.Create (aDownloadURL : String);
Begin
  fDownloadURL := aDownloadURL;
  Synchronized := False; // Wenn die VCL verwendet wird, auf True setzen
  UsesCOMObjects := False; // Wenn COM-Objekte (z.B. ADO) verwendet wird, auf True setzen
// Indie-Komponenten instantiieren
End;
  
Destructor TDownloadJob.Destroy;
Begin
// Indie-Komponenten freigeben
End;

Procedure TDownloadJob.Execute (Thread : TWorkerThread);
Begin
  fIndieComponent.Download (fDownLoadURL);
End;
...
// PendingJobs ist ein Threadpool, der Jobs im Hintergrund ausführt.
PendingJobs.Add (TDownloadJob.Create('www.delphi-forum.de/SampleDownload.zip'));
PendingJobs.Add (TDownloadJob.Create('www.another-source.com/moredownloads.zip'));

Hier mal der Link:
www.delphipraxis.net...st735273.html#735273

_________________
Na denn, dann. Bis dann, denn.
Novo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 90

Win XP, Win 7
Delphi 7 Enterprise, Delphi 2009
BeitragVerfasst: Mo 08.10.07 20:43 
user profile iconalzaimar hat folgendes geschrieben:
In dr Delphi-Praxis habe ich einen Threadpool vorgestellt, der die Arbeit mit Threads stark vereinfacht. Du musst nur noch den Job definieren, der im Hintergrund ausgeführt werden soll.

ausblenden Delphi-Quelltext
1:
2:
PendingJobs.Add (TDownloadJob.Create('www.delphi-forum.de/SampleDownload.zip'));
PendingJobs.Add (TDownloadJob.Create('www.another-source.com/moredownloads.zip'));



d.h. dass ich statt

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
URL := Form1.LinkList.Items.Item[0].Caption;
Dateiname := GetFileName(URL);
LinkList.Items.Item[0].SubItems.Strings[1] := 'Läuft';
Application.ProcessMessages;

lStream:=TFileStream.Create(Downloadpfad+Dateiname, fmCreate or fmShareDenyWrite);
try
idhttp1.Get(URL,lStream);
finally
lStream.Free;
end;


das mit PendingJobs aufrufe?
aber ich brauche doch das
lStream:=TFileStream.Create(Downloadpfad+Dateiname...


wie jetzt?