ho utilizzato il primo metoto, che per il momento, sembra risolvere il mio problema...
codice:
procedure TForm1.BtnScaricaFotoClick(Sender: TObject);
var
SourceFile, LocalFile: string;
ora:TdateTime;
SR : TSearchRec;
begin
...
...
BtnStop.Enabled:=True;
BtnScaricaFoto.Enabled:=False;
ora:=cxDateEditDal.Date;
while ora<=cxDateEditAl.Date do
begin
application.processmessages;
if not BtnStop.Enabled then break;
SourceFile := 'http://www.villamia.it/webcam/img_'+FormatDateTime('yyyymmdd',ora)+'_'+FormatDateTime('hhnnss',ora)+'_0.jpeg';
LocalFile := ExtractFilePath(Application.ExeName)+'img\'+ExtractUrlFileName(SourceFile);
LblFoto.Caption:='Download File...'+SourceFile;
LblFoto.Update;
if not FileExists(LocalFile) then
if URLDownloadToFile(nil, PChar(SourceFile), PChar(LocalFile), 0, nil) = 0 then
begin
try
cxImageFoto.Picture.LoadFromFile(LocalFile);
cxImageFoto.Update;
except
end;
end;
ora:=IncSecond(ora,1);
end;
....
....
procedure TForm1.BtnStopClick(Sender: TObject);
begin
BtnStop.Enabled:=False;
BtnScaricaFoto.Enabled:=True;
end;
grazie