procedure TForm1.Button2Click(Sender: TObject);
var
d2,D:IHTMLDocument2;
d1:IHTMLDocument;
e:IHTMLElement;
e2:IHTMLElement2;
cp:IHTMLControlRange;
img,img1:IHTMLImgElement;
ce:IHTMLControlElement;
myitem:Olevariant;
i:integer;
begin D:= webbrowser1.Document as IHTMLDocument2;
e:=d.body as IHTMLElement;
e2:=e as IHTMLElement2;
cp:=e2.createControlRange as IHTMLControlRange;
d2:= webbrowser1.Document as IHTMLDocument2;
myitem := WebBrowser1.Document;
for i := 0 to D.images.length - 1 do
begin
img1:=D.all.item(i,varempty) as IHTMLImgElement;
if img1.src='images/buttom_01_01.jpg' then
img:=img1 AS IHTMLImgElement;
begin
end;
end;
// Clipboard.Assign(img as IHTMLImgElement);
// img:=d2.images.item('images/buttom_01_01.jpg',0) AS IHTMLImgElement;
ce:=img as IHTMLControlElement;
cp.add(ce);
cp.execCommand('Copy',false,0);
end;初始化如下
initialization
OleInitialize(nil);
finalization
OleUninitialize;//end.前面。
在uses中加入ActiveX
============================================不过运行时提示interface not supported ...不知道什么原因,,,急
var
d2,D:IHTMLDocument2;
d1:IHTMLDocument;
e:IHTMLElement;
e2:IHTMLElement2;
cp:IHTMLControlRange;
img,img1:IHTMLImgElement;
ce:IHTMLControlElement;
myitem:Olevariant;
i:integer;
begin D:= webbrowser1.Document as IHTMLDocument2;
e:=d.body as IHTMLElement;
e2:=e as IHTMLElement2;
cp:=e2.createControlRange as IHTMLControlRange;
d2:= webbrowser1.Document as IHTMLDocument2;
myitem := WebBrowser1.Document;
for i := 0 to D.images.length - 1 do
begin
img1:=D.all.item(i,varempty) as IHTMLImgElement;
if img1.src='images/buttom_01_01.jpg' then
img:=img1 AS IHTMLImgElement;
begin
end;
end;
// Clipboard.Assign(img as IHTMLImgElement);
// img:=d2.images.item('images/buttom_01_01.jpg',0) AS IHTMLImgElement;
ce:=img as IHTMLControlElement;
cp.add(ce);
cp.execCommand('Copy',false,0);
end;初始化如下
initialization
OleInitialize(nil);
finalization
OleUninitialize;//end.前面。
在uses中加入ActiveX
============================================不过运行时提示interface not supported ...不知道什么原因,,,急
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货