C# NEED HELP Copy Captcha Image From WebBrowser To PictureBox

03/16/2012 15:20 tariqx111#1
Hello Guys
im Trying To Make Account Maker But When Im Trying Get Captcha Image
Its Give Me Another Captcha Not Same The One In WebBrowser :mad:
Any Help ?
03/16/2012 16:07 !llu#2
Probably you could do it with Spy++.
.Net is compatible with Spy++ so i think its working ;o
03/16/2012 16:39 tariqx111#3
Quote:
Originally Posted by DarkAzrail View Post
Probably you could do it with Spy++.
.Net is compatible with Spy++ so i think its working ;o
Spy++ ?
What Is Spy++
03/16/2012 18:06 Al Kappaccino#4
Quote:
Originally Posted by tariqx111 View Post
Spy++ ?
What Is Spy++
Google is your friend you know. It's a tool that comes with Visual Studio.

Also it would be helpful to give some informations, because YOU want help and you can't get help if you just say "it don't work".
03/16/2012 18:29 tariqx111#5
Why Im Ask On Here ?? = For not result in Google
03/16/2012 18:42 !llu#6
[Only registered and activated users can see links. Click Here To Register...]
03/16/2012 18:56 MoepMeep#7
Too bad spy++ has nothing to do with that problem. ;o
03/16/2012 20:56 tariqx111#8
When I Copy It Manual From Webbrowser
And Use This
pictureBox1.Image = Clipboard.GetImage();
Fully Working
But I Want Select And Copy The Image Automatic
Help ?
03/16/2012 22:40 Al Kappaccino#9
Code:
if (wb.ReadyState == WebBrowserReadyState.Complete) {
	HtmlElement captcha = wb.Document.GetElementById("yourid");
	string link = captcha.GetAttribute("src");

	System.Net.WebClient MyWebClient = new System.Net.WebClient();
	byte[] ImageInBytes = MyWebClient.DownloadData(link);
	System.IO.MemoryStream ImageStream = new System.IO.MemoryStream(ImageInBytes);

	pb.Image = new System.Drawing.Bitmap(ImageStream);
}
03/17/2012 11:49 tariqx111#10
Quote:
Originally Posted by JakeFrost77 View Post
Code:
if (wb.ReadyState == WebBrowserReadyState.Complete) {
	HtmlElement captcha = wb.Document.GetElementById("yourid");
	string link = captcha.GetAttribute("src");

	System.Net.WebClient MyWebClient = new System.Net.WebClient();
	byte[] ImageInBytes = MyWebClient.DownloadData(link);
	System.IO.MemoryStream ImageStream = new System.IO.MemoryStream(ImageInBytes);

	pb.Image = new System.Drawing.Bitmap(ImageStream);
}
Error : Object reference not set to an instance of an object.



EDIT : Working But Give Me Antoher Captcha Not Same The One In WebBrowser
03/17/2012 12:45 jacky919#11
To get the captcha displayed in the browser you have to read the htmlcode of the current displayed page. Captchas are generated randomly so you will get another one in an other instance of the browser. If you want to make a good account creator use packets and abstract the unimportant things from the user. The user should see only the UI where he is able to enter name/password/emal and so on. If the user clicks on a "create" button the account creation is started.
03/17/2012 19:49 tariqx111#12
i got it YEs YES !!
Code:
        Image Getmg()
        {
            mshtml.HTMLWindow2 w2 = (mshtml.HTMLWindow2)webBrowser1.Document.Window.DomWindow;
            w2.execScript("var ctrlRange = document.body.createControlRange();ctrlRange.add(document.getElementById('Validater1'));ctrlRange.execCommand('Copy');", "javascript");
            return Clipboard.GetImage();
        }