- uses
- ActiveX,ComObj;
- procedure TfrmMain.FormCreate(Sender: TObject);
- begin
- OleInitialize(nil);
- end;
-
- procedure TfrmMain.DomImg2Image(wb:TWebBrowser);
- var
- i:Integer;
- rang:IHTMLControlRange;
- s:string;
- begin
- try
-
- s := (IHTMLDocument2(wb.Document).images.item(‘pic‘,EmptyParam) as IHTMLElement).getAttribute(‘src‘,0);
-
- rang:=((IHTMLDocument2(wb.Document).body as HTMLBody).createControlRange)as
- IHTMLControlRange;
- rang.add(IHTMLDocument2(wb.Document).images.item(‘pic‘,EmptyParam)as
- IHTMLControlElement);
- rang.execCommand(‘Copy‘,False,0);
- image1.Picture.Assign(ClipBoard);
- except
- end;
- end;
-
- procedure TfrmMain.FormDestroy(Sender: TObject);
- begin
- OleUninitialize;
- end;
http://blog.csdn.net/yanjiaye520/article/details/7955671