WebBrowser复制图片到剪贴板问题?急,,急,,,在线等!!!
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 ...不知道什么原因,,,急
[解决办法]
接口调用不对@