100分求c#winform模拟注册百度帐号代码 验证码 手动输入 即可 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 string uname = ""; private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { if (webBrowser1.Url.ToString() == "https://passport.baidu.com/?reg") { FileStream fs = new FileStream("baidu.txt", FileMode.Append); StreamWriter sw = new StreamWriter(fs, Encoding.Default); sw.Write(uname + "-----" + txtPwd.Text + "\r\n"); sw.Close(); fs.Close(); fs.Dispose(); webBrowser1.Navigate("https://passport.baidu.com/?reg&tpl=mn"); } if (webBrowser1.ReadyState > WebBrowserReadyState.Interactive) { Random rd = new Random(); uname = txtname.Text + rd.Next(100) + 20; ; HtmlDocument hd = webBrowser1.Document; HtmlElement usernameforload = hd.GetElementById("usernameforload"); usernameforload.InnerText = uname; HtmlElement txtloginpass = hd.GetElementById("txtloginpass"); txtloginpass.InnerText = txtPwd.Text; HtmlElementCollection verifypass = hd.GetElementsByTagName("INPUT"); for (int i = 0; i < verifypass.Count; i++) { if (verifypass[i].Name == "verifypass") { verifypass[i].InnerText = txtPwd.Text; break; } } HtmlElement email_address = hd.GetElementById("email_address"); email_address.InnerText = "[email protected]"; HtmlElement sex = hd.GetElementById("sex"); sex.SetAttribute("checked", "checked"); HtmlElement btn_submit = hd.GetElementById("btn_submit"); btn_submit.InnerText = "批量注册百度账号"; } } private void button1_Click(object sender, EventArgs e) { webBrowser1.Navigate("https://passport.baidu.com/?reg&tpl=mn"); }不知道对你有没有用 有用 但是 能不用 webBrowser吗 谢谢了 如果是winform实现,remoting,wcf技术是可以实现滴楼主可以从这两方面看看。。 你 这是模拟的应该要用到webBrowser1的吧? 模拟 post可以的 我研究的以前 可以用 最近不成了 哈哈 http://wenku.baidu.com/view/c1b49a36a32d7375a4178090.html 要下班了,没时间写代码webrequest webresponse不行吗 webrequest 不行 模拟提交 没有反应 webrequest 不行 模拟提交 没有反应 建立一个C# 项目叫做code将下面代码粘贴到相应文件当中:一共两个文件Form1.Designer.cs:namespace code{ partial class Form1 { /// <summary> /// 必需的设计器变量。 /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// 清理所有正在使用的资源。 /// </summary> /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows 窗体设计器生成的代码 /// <summary> /// 设计器支持所需的方法 - 不要 /// 使用代码编辑器修改此方法的内容。 /// </summary> private void InitializeComponent() { this.pictureBox1 = new System.Windows.Forms.PictureBox(); this.button1 = new System.Windows.Forms.Button(); this.textBox1 = new System.Windows.Forms.TextBox(); this.button2 = new System.Windows.Forms.Button(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); this.SuspendLayout(); // // pictureBox1 // this.pictureBox1.Location = new System.Drawing.Point(12, 12); this.pictureBox1.Name = "pictureBox1"; this.pictureBox1.Size = new System.Drawing.Size(100, 50); this.pictureBox1.TabIndex = 0; this.pictureBox1.TabStop = false; // // button1 // this.button1.Location = new System.Drawing.Point(12, 95); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(75, 23); this.button1.TabIndex = 1; this.button1.Text = "看不清楚"; this.button1.UseVisualStyleBackColor = true; this.button1.Click += new System.EventHandler(this.button1_Click); // // textBox1 // this.textBox1.Location = new System.Drawing.Point(12, 68); this.textBox1.Name = "textBox1"; this.textBox1.Size = new System.Drawing.Size(100, 21); this.textBox1.TabIndex = 2; // // button2 // this.button2.Location = new System.Drawing.Point(93, 95); this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(75, 23); this.button2.TabIndex = 3; this.button2.Text = "确定"; this.button2.UseVisualStyleBackColor = true; this.button2.Click += new System.EventHandler(this.button2_Click); // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(292, 266); this.Controls.Add(this.button2); this.Controls.Add(this.textBox1); this.Controls.Add(this.button1); this.Controls.Add(this.pictureBox1); this.Name = "Form1"; this.Text = "Form1"; ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.PictureBox pictureBox1; private System.Windows.Forms.Button button1; private System.Windows.Forms.TextBox textBox1; private System.Windows.Forms.Button button2; }}Form1.cs:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using System.Drawing;using System.Drawing.Drawing2D;using System.Drawing.Imaging;namespace code{ public partial class Form1 : Form { public String sRand = ""; public Form1() { InitializeComponent(); draw(); } private Color getRandColor(int fc, int bc) { Random random = new Random(); if (fc > 255) fc = 255; if (bc > 255) bc = 255; int r = fc + random.Next(bc - fc); int g = fc + random.Next(bc - fc); int b = fc + random.Next(bc - fc); Color c = Color.FromArgb(r, g, b); return c; } public void draw() { int width = 60, height = 20; Bitmap image = new Bitmap(width, height); Graphics g = Graphics.FromImage(image); Random random = new Random(); LinearGradientBrush brush = new LinearGradientBrush(new Rectangle(0, 0, 10, 10), getRandColor(200, 250), getRandColor(200, 250), 0F, false); g.FillRectangle(brush, 0, 0, width, height); Pen p = new Pen(getRandColor(200, 250)); for (int i = 0; i < 150; i++) { int x = random.Next(width); int y = random.Next(height); int xl = random.Next(10); int yl = random.Next(10); g.DrawLine(p, x, y, x + xl, y + yl); } p = new Pen(Color.Black); g.DrawRectangle(p, 0, 0, width - 1, height - 1); for (int i = 0; i < 4; i++) { String rand = random.Next(10).ToString(); sRand += rand; brush = new LinearGradientBrush(new Point(0, 0), new Point(10, 10), Color.Black, Color.Black); g.DrawString(rand, new Font("宋体", 12), brush, 13 * i + 3, 0); } pictureBox1.Image = image; } private void button1_Click(object sender, EventArgs e) { draw(); } private void button2_Click(object sender, EventArgs e) { if (textBox1.Text.Equals(sRand)) { MessageBox.Show("OK"); } } }} 你不是说winform开发,输入验证码吗?你照着做,运行,界面是一个验证码,一个输入框两个按钮,一个“看不清楚”一个“确定”点击看不清楚,验证码会随机重置,输入数字点击确定,判断验证码是否正确,正确弹出窗口这不就是你要的效果吗? 38行少了一句话public void draw() { sRand = ""; int width = 60, height = 20; 哥 你没看标题 呀 c#winform模拟注册百度帐号代码 晕 你试试 模拟post 实现以下 winfrom不用webBrowser 好像不行吧 求一正则 【非负整数和非负浮点数】 类似ATM凭条打印模块的源码 求助:Access提示操作符丢失。MSSQL转Access问题 ++++ VSS二次开发,获取版本信息问题 ++++ DATASET 刷新问题 基础送分题,抢分的来 对一个类的实例,怎么知道是否对其中的属性进行了赋值操作? 请问windows API的详细信息到那里去看啊? 求助关于调用dll出错的问题。 关于dataset的问题 Winform中关于TooStrip的 【求助】是不是淘宝现在换了什么新技术了?做过自动登录,秒杀,xxx...的大神们帮帮我
private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
if (webBrowser1.Url.ToString() == "https://passport.baidu.com/?reg")
{
FileStream fs = new FileStream("baidu.txt", FileMode.Append);
StreamWriter sw = new StreamWriter(fs, Encoding.Default);
sw.Write(uname + "-----" + txtPwd.Text + "\r\n");
sw.Close();
fs.Close();
fs.Dispose();
webBrowser1.Navigate("https://passport.baidu.com/?reg&tpl=mn");
}
if (webBrowser1.ReadyState > WebBrowserReadyState.Interactive)
{
Random rd = new Random();
uname = txtname.Text + rd.Next(100) + 20; ;
HtmlDocument hd = webBrowser1.Document;
HtmlElement usernameforload = hd.GetElementById("usernameforload");
usernameforload.InnerText = uname;
HtmlElement txtloginpass = hd.GetElementById("txtloginpass");
txtloginpass.InnerText = txtPwd.Text;
HtmlElementCollection verifypass = hd.GetElementsByTagName("INPUT");
for (int i = 0; i < verifypass.Count; i++)
{
if (verifypass[i].Name == "verifypass")
{
verifypass[i].InnerText = txtPwd.Text;
break;
}
}
HtmlElement email_address = hd.GetElementById("email_address");
email_address.InnerText = "[email protected]";
HtmlElement sex = hd.GetElementById("sex");
sex.SetAttribute("checked", "checked");
HtmlElement btn_submit = hd.GetElementById("btn_submit");
btn_submit.InnerText = "批量注册百度账号";
}
}
private void button1_Click(object sender, EventArgs e)
{
webBrowser1.Navigate("https://passport.baidu.com/?reg&tpl=mn");
}不知道对你有没有用
楼主可以从这两方面看看。。
将下面代码粘贴到相应文件当中:一共两个文件Form1.Designer.cs:
namespace code
{
partial class Form1
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null; /// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
} #region Windows 窗体设计器生成的代码 /// <summary>
/// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.button1 = new System.Windows.Forms.Button();
this.textBox1 = new System.Windows.Forms.TextBox();
this.button2 = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.SuspendLayout();
//
// pictureBox1
//
this.pictureBox1.Location = new System.Drawing.Point(12, 12);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(100, 50);
this.pictureBox1.TabIndex = 0;
this.pictureBox1.TabStop = false;
//
// button1
//
this.button1.Location = new System.Drawing.Point(12, 95);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 1;
this.button1.Text = "看不清楚";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(12, 68);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(100, 21);
this.textBox1.TabIndex = 2;
//
// button2
//
this.button2.Location = new System.Drawing.Point(93, 95);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(75, 23);
this.button2.TabIndex = 3;
this.button2.Text = "确定";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(292, 266);
this.Controls.Add(this.button2);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.button1);
this.Controls.Add(this.pictureBox1);
this.Name = "Form1";
this.Text = "Form1";
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.ResumeLayout(false);
this.PerformLayout(); } #endregion private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Button button2;
}
}
Form1.cs:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;using System.Drawing;using System.Drawing.Drawing2D;using System.Drawing.Imaging;
namespace code
{
public partial class Form1 : Form
{
public String sRand = "";
public Form1()
{
InitializeComponent();
draw();
} private Color getRandColor(int fc, int bc)
{
Random random = new Random();
if (fc > 255) fc = 255;
if (bc > 255) bc = 255;
int r = fc + random.Next(bc - fc);
int g = fc + random.Next(bc - fc);
int b = fc + random.Next(bc - fc);
Color c = Color.FromArgb(r, g, b);
return c;
}
public void draw()
{
int width = 60, height = 20;
Bitmap image = new Bitmap(width, height);
Graphics g = Graphics.FromImage(image);
Random random = new Random();
LinearGradientBrush brush = new LinearGradientBrush(new Rectangle(0, 0, 10, 10), getRandColor(200, 250), getRandColor(200, 250), 0F, false);
g.FillRectangle(brush, 0, 0, width, height);
Pen p = new Pen(getRandColor(200, 250));
for (int i = 0; i < 150; i++)
{
int x = random.Next(width);
int y = random.Next(height);
int xl = random.Next(10);
int yl = random.Next(10);
g.DrawLine(p, x, y, x + xl, y + yl);
}
p = new Pen(Color.Black);
g.DrawRectangle(p, 0, 0, width - 1, height - 1);
for (int i = 0; i < 4; i++)
{
String rand = random.Next(10).ToString();
sRand += rand;
brush = new LinearGradientBrush(new Point(0, 0), new Point(10, 10), Color.Black, Color.Black);
g.DrawString(rand, new Font("宋体", 12), brush, 13 * i + 3, 0);
}
pictureBox1.Image = image;
} private void button1_Click(object sender, EventArgs e)
{
draw();
} private void button2_Click(object sender, EventArgs e)
{
if (textBox1.Text.Equals(sRand))
{
MessageBox.Show("OK");
}
}
}}
你照着做,运行,界面是一个验证码,一个输入框两个按钮,一个“看不清楚”一个“确定”
点击看不清楚,验证码会随机重置,输入数字点击确定,判断验证码是否正确,正确弹出窗口
这不就是你要的效果吗?
public void draw()
{
sRand = "";
int width = 60, height = 20;
哥 你没看标题 呀
c#winform模拟注册百度帐号代码