Цитата(Данкинг @ 24.6.2010, 01:53) | Сохранение картинок из браузера - был пример в ДРКБ. Примерно так:
Код | 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.SpeedButton1Click(Sender: TObject);
var k, p: Integer; Source, dest, ext: string; begin try 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') or (ext = 'PNG') then begin p := LastDelimiter('/', Source); dest := ExtractFilePath(ParamStr(0)) + Copy(Source, p + 1, Length(Source)); dest:=DirectoryListBox1.Directory+'\'+extractfilename(dest); DownloadFile(Source, dest); end; end; MessageDlg ('Сохранено!',mtinformation,[mbyes],0); except showmessage ('Нет загруженной страницы!'); end;
end;
|
|
Где описана UrlDownloadToFile, подскажите ? |