delphibbs 里面特别多这样的代码,呵呵我自己都发了一些(随便捡一段) D:=webbrowser1.Document as IHTMLDocument2; e:=d.body as IHTMLElement; e2:=e as IHTMLElement2; cp:=e2.createControlRange as IHTMLControlRange; d2:=webbrowser1.Document as IHTMLDocument2; //下面是破解验证码 coll := d.all; coll := (coll.tags('img') as IHTMLElementCollection); for i := 0 to coll.Length - 1 do begin // 循环取出每个url elem := (coll.item(i, 0) as IHTMLElement); url := Trim(string(elem.getAttribute(WideString('src'), 0))); //Text := Trim(string(elem.outertext)); if pos('CodeNubImg', url) >0 then // getCheckImg CodeNubImg bbb_dnzb begin Break; end; //DebugInfo(text+#13#10+url) ; Application.ProcessMessages; end; img:=elem as IHTMLImgElement; ce:=img as IHTMLControlElement; cp.add(ce); try Clipboard.Open; Clipboard.Clear; if Clipboard.hasFormat(CF_BITMAP) then showmessage('CF_BITMAP'); if Clipboard.hasFormat(CF_TEXT) then showmessage('CF_TEXT'); if Clipboard.hasFormat(CF_METAFILEPICT) then showmessage('CF_METAFILEPICT'); if Clipboard.hasFormat(CF_PICTURE) then showmessage('CF_PICTURE'); if Clipboard.hasFormat(CF_COMPONENT) then showmessage('CF_COMPONENT'); try cp.execCommand('Copy',false,0); MyHandle := Clipboard.GetAsHandle(cf_Bitmap); //cf_Bitmap CF_DIB CF_METAFILEPICT bmpPtr := GlobalLock(MyHandle); // image1.Picture.LoadFromClipboardFormat(cf_BitMap,ClipBoard.GetAsHandle(cf_Bitmap),0); image1.Picture.Bitmap.Assign(Clipboard); image1.Picture.LoadFromClipboardFormat(cf_BitMap,MyHandle,0); //CF_DIB cf_BitMap CF_METAFILEPICT Clipboard.Clear; GlobalUnlock(MyHandle); finally Clipboard.Close; end; // end; bmp:=(image1.Picture.Bitmap as TBitmap) ; //checkstr:=getCheckStr(bmp); except if clipboard.HasFormat(CF_BITMAP) then image1.Picture.LoadFromClipboardFormat(cf_BitMap,ClipBoard.GetAsHandle(cf_Bitmap),0); end;end;