uses UrlMon
function DownloadFile(SourceFile, DestFile: string): Boolean;
begin
try
Result := UrlDownloadToFile(nil, PChar(SourceFile), PChar(DestFile), 0,
nil) = 0;
except
Result := False;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
k, p: Integer;
source, dest, ext: string;
begin
for k := 0 to WebBrowser1.OleObject.Document.Images.Length - 1 do
begin
source := WebBrowser1.OleObject.Document.Images.Item(k).Src;
p := LastDelimiter('.', source);
ext := UpperCase(Copy(source, p+1, Length(source)));
if (ext = 'GIF') or (ext = 'JPG') then
begin
p := LastDelimiter('/', source);
dest := ExtractFilePath(ParamStr(0)) + Copy(source, p+1,
Length(source));
DownloadFile(source, dest);
end;
end;
end;