Solve the problem that C # can not get by using WebBrowser to intercept CAPTCHA images

Source: Internet
Author: User

1 /// <summary>2         ///returns the picture in the specified WebBrowser</IMG>the contents of the diagram in3         /// </summary>4         /// <param name= "Webctl" >WebBrowser Controls</param>5         /// <param name= "Imgetag" >img Element</param>6         /// <returns>img Object</returns>7         PrivateImage getwebimage (WebBrowser webctl, HtmlElement imgetag)8         {9HTMLDocument doc =(HTMLDocument) WebCtl.Document.DomDocument;TenHTMLBody BODY =(HTMLBody) doc.body; OneIhtmlcontrolrange rang =(Ihtmlcontrolrange) Body.createcontrolrange (); AIHTMLControlElement Img = (ihtmlcontrolelement) imgetag.domelement;//Image Address -   -Image oldimage =clipboard.getimage (); the Rang.add (IMG); -Rang.execcommand ("Copy",false,NULL);//Copy to Memory -Image Numimage =clipboard.getimage (); -             Try +             { - clipboard.setimage (oldimage); +             } A             Catch at             { -             } -   -             returnNumimage; -}

Above this code normally can get to the verification code, in some win2003 back problems.

In the previous development, due to the disabling of WebBrowser error prompts, no error prompts, do not know what the cause.

How to: Open IE Internet Options, security--Custom level, allow clipboard for programmatic access, enable this option

Solve the problem that C # can not get by using WebBrowser to intercept CAPTCHA images

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.