标签:ring begin ram ini 创建时间 ima copy int create
Delphi TWebBrowser[7] 获取网页图片(静态和动态)
1、静态图常用方法:
uses WinInet
function GetLocalFileNameFromIECache(url:string; var LocalFileName:string):DWORD;
var
D: Cardinal;
T: PInternetCacheEntryInfo;
begin
result := S_OK;
D := 0;
T:=nil;
GetUrlCacheEntryInfo(PChar(Url), T^, D);
Getmem(T, D);
try
if (GetUrlCacheEntryInfo(PChar(Url), T^, D)) then
LocalFileName:=T^.lpszLocalFileName
else
Result := GetLastError;
finally
Freemem(T, D);
end;
end;
2、动态图
uses MsHtml, ActiveX, ClipBrd
var
iIndex: Integer;
Rang:IHTMLControlRange;
ImgSel: IHTMLControlElement;
begin
iIndex := 0; //所需的图片在网页中出现的顺序
Rang := ((IHTMLDocument2(WebBrowser1.Document).body as HTMLBody).createControlRange) as IHTMLControlRange;
ImgSel := IHTMLDocument2(WebBrowser1.Document).images.item(iIndex,EmptyParam)as IHTMLControlElement;
Rang.add(ImgSel);
Rang.execCommand(‘Copy‘, False, 0);
Image1.Picture.Assign(ClipBoard);
end;
创建时间:2020.11.23 更新时间:
Delphi TWebBrowser[7] 获取网页图片(静态和动态)
标签:ring begin ram ini 创建时间 ima copy int create
原文地址:https://www.cnblogs.com/guorongtao/p/14022790.html