Also habe ich das so richtig verstanden, dass ich bei jedem zugriff auf das
GUI bzw. eine locale Variable "Synchronize" verwenden sollte ?
also dann so:
Delphi-Quellcode:
procedure TDownload.Execute;
var FS:TFileStream;
slTime,elTime:TDateTime;
fail:Boolean;
Leechedsize,Filesize:int64;
begin
http := TidHTTP.Create;
dir := appdir + '
data/download/';
Synchronize(FOrm1.p_download.Caption := '
Action: Trying ' + rls);
Synchronize(Form1.lv_download.Items.Add.Caption := TITLE);
gitem := Synchronize(Form1.lv_download.Items.Count-1);
if DirectoryExists(dir)
then
begin
Synchronize(Form1.lv_download.Items[gitem].SubItems.Add('
Already Exists'));
end
else
begin
Synchronize(Form1.p_download.Caption := '
Action: Start Downloading ' + rls);
Synchronize(Form1.lv_download.Items[gitem].SubItems.Add('
Downloading'));
slTime := now;
FS:=Tfilestream.Create(dir + '
/' + TITLE,fmCreate);
fail := False;
leechedsize := 0;
http.Head(
URL);
filesize := http.Response.ContentLength;
{...}
http.free;
Synchronize(Inc(Form1.CurThreads,-1));
end;