title: Copy an image from WebBrowser
body: <pre><code>    IHTMLDocument2 doc = (IHTMLDocument2)browser.Document.DomDocument;
      HTMLBody body = (HTMLBody)doc.body;
      Bitmap testImage;
  
      foreach (IHTMLImgElement img in doc.images)
      {
          if (img.src.IndexOf("some text here", 0) != -1) 
          {
              IHTMLControlRange imgRange;
              imgRange = (IHTMLControlRange)body.createControlRange();
              imgRange.add((IHTMLControlElement)img);
              imgRange.execCommand("Copy", false, null);
              //captchaUrl = img.GetAttribute("src");
              testImage = (Bitmap)Clipboard.GetDataObject().GetData(DataFormats.Bitmap);
          }
      }
  </code></pre>
  
  <p>Hi guys, this is my third attempt at taking an image from the WebBrowser control. First I tried by src, this game me a bad image. Then I tried to inject javascript, wasen't successful. Now I am trying this. It is finding the image, but I cant convert it to a Bitmap.</p>
  
  <p>Any help?</p>
  
  <p>Edit: Code is c#</p>
  
  <p>Edit Edit: I just put the WebBrowser control in question on the form to see a visual representation, and the image I am trying to pull isn't loading. Maybe this is the problem?</p>