using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Threading;
using System.IO; namespace WindowsFormsApplication1
{
public partial class Form4 : Form
{
public Form4()
{
InitializeComponent(); }
void mouse_OnMouseActivity(object sender, MouseEventArgs e)
{
string str = "X:" + e.X + " Y:" + e.Y;
this.Text = str;
}
#region API单击
[DllImport("user32.dll", SetLastError = true)]
private static extern IntPtr GetWindow(IntPtr hWnd, uint uCmd);
[DllImport("user32.dll", CharSet = CharSet.Auto)]
private static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);
private void DoMouseClick(int ex, int ey)
{
IntPtr handle = this.webBrowser1.Handle;
StringBuilder lpClassName = new StringBuilder();
while (lpClassName.ToString() != "Internet Explorer_Server")
{
handle = GetWindow(handle, );
GetClassName(handle, lpClassName, lpClassName.Capacity);
}
IntPtr lParam = (IntPtr)((ey << 0x10) | ex);
IntPtr zero = IntPtr.Zero;
SendMessage(handle, 0x201, zero, lParam);
SendMessage(handle, 0x202, zero, lParam);
}
private void DoMouseClick(IntPtr handle, int ex, int ey)
{
StringBuilder lpClassName = new StringBuilder();
while (lpClassName.ToString() != "Internet Explorer_Server")
{
handle = GetWindow(handle, );
GetClassName(handle, lpClassName, lpClassName.Capacity);
}
IntPtr lParam = (IntPtr)((ey << 0x10) | ex);
IntPtr zero = IntPtr.Zero;
SendMessage(handle, 0x201, zero, lParam);
SendMessage(handle, 0x202, zero, lParam);
}
[DllImport("user32.dll", CharSet = CharSet.Auto)]
private static extern int GetClassName(IntPtr hWnd, StringBuilder lpClassName, int nMaxCount);
#endregion int i = ;
private void Form4_Load(object sender, EventArgs e)
{
txt_uid.Text = listBox1.Items[].ToString().Replace("----", "-").Split('-')[];
txt_pwd.Text = listBox1.Items[].ToString().Replace("----", "-").Split('-')[];
//timer1.Interval = 20;
//timer1.Interval = 1000;
//timer1.Interval = 2000;
}
MouseHook mouse = new MouseHook();
private void button1_Click(object sender, EventArgs e)
{ try
{
// i++;
//if (i > listBox1.Items.Count)
//{
// MessageBox.Show("全部已打开一次");
// return;
//}
//txt_uid.Text = listBox1.Items[i].ToString().Replace("----", "-").Split('-')[0];
//txt_pwd.Text = listBox1.Items[i].ToString().Replace("----", "-").Split('-')[1]; HtmlDocument cd = webBrowser1.Document;
HtmlElement element = webBrowser1.Document.GetElementById("uin");//id或者是name
element.InnerText = txt_uid.Text;
element = webBrowser1.Document.GetElementById("pwd");//id或者是name
element.InnerText = txt_pwd.Text; // 第一种情况butten 按钮有id或者name
HtmlElement buttonSubmit = this.webBrowser1.Document.GetElementById("submitBtn");
buttonSubmit.InvokeMember("click");
}
catch (Exception)
{ // throw;
} } private void button2_Click(object sender, EventArgs e)
{
webBrowser1.Navigate(new Uri("https://w.mail.qq.com/cgi-bin/loginpage?f=xhtml"));
} private void button3_Click(object sender, EventArgs e)
{
Rectangle rt = webBrowser1.Document.Body.ScrollRectangle;
webBrowser1.Document.Window.ScrollTo(, rt.Height);
} private void button5_Click(object sender, EventArgs e)
{
i++;
if (i > listBox1.Items.Count)
return;
txt_uid.Text = listBox1.Items[i].ToString().Replace("----", "-").Split('-')[];
txt_pwd.Text = listBox1.Items[i].ToString().Replace("----", "-").Split('-')[];
} private void button6_Click(object sender, EventArgs e)
{
listBox1.Items.Clear();
Read("1.txt");
labcout.Text = "总共:"+listBox1.Items.Count.ToString();
i = ;
}
public void Read(string path)
{
StreamReader sr = new StreamReader(path, Encoding.Default);
String line;
while ((line = sr.ReadLine()) != null)
{
listBox1.Items.Add(line.ToString());
}
} private void button7_Click(object sender, EventArgs e)
{
//HtmlElementCollection link = this.webBrowser1.Document.GetElementsByTagName("a");
// for (int ii = 0; ii < link.Count; ii++)
// {
// if (link[ii].GetAttribute("href").ToLower().IndexOf("http://mail.qq.com/cgi-bin/frame_html?") == 0 && link[ii].GetAttribute("href").ToLower().IndexOf("&st=0&p=") > 0) // link[ii].InvokeMember("click");
// }
herfclick("http://mail.qq.com/cgi-bin/frame_html?f=html&sid=rxOuQ-CEBfe1KCx4Uc-T5vNw");
// http://mail.qq.com/cgi-bin/frame_html?f=html&sid=9YMxbM2xOc2PCHMnUfnT5vNw
}
private void herfclick(string url)
{ for (int i = ; i < webBrowser1.Document.All.Count; i++)
{
if (webBrowser1.Document.All[i].GetAttribute("href").ToString().Trim().Length > )
{
if (webBrowser1.Document.All[i].TagName == "A" && webBrowser1.Document.All[i].GetAttribute("href").ToString().Trim().Substring(, ) == url.Substring(, ))
{ webBrowser1.Document.All[i].InvokeMember("click");//引发”CLICK”事件 break; }
}
} } private void listBox1_Click(object sender, EventArgs e)
{
txt_uid.Text =listBox1.Items[listBox1.SelectedIndex].ToString().Replace("----", "-").Split('-')[];
txt_pwd.Text = listBox1.Items[listBox1.SelectedIndex].ToString().Replace("----", "-").Split('-')[];
timer1.Start();
timer2.Start();
timer3.Start();
timer4.Start();
} private void button8_Click(object sender, EventArgs e)
{
//
webBrowser1.Navigate(new Uri("https://w.mail.qq.com/cgi-bin/loginpage?f=xhtml"));
Thread.Sleep();
Rectangle rt = webBrowser1.Document.Body.ScrollRectangle;
webBrowser1.Document.Window.ScrollTo(, rt.Height);
//
try
{
// i++;
//if (i > listBox1.Items.Count)
//{
// MessageBox.Show("全部已打开一次");
// return;
//}
//txt_uid.Text = listBox1.Items[i].ToString().Replace("----", "-").Split('-')[0];
//txt_pwd.Text = listBox1.Items[i].ToString().Replace("----", "-").Split('-')[1]; HtmlDocument cd = webBrowser1.Document;
HtmlElement element = webBrowser1.Document.GetElementById("uin");//id或者是name
element.InnerText = txt_uid.Text;
element = webBrowser1.Document.GetElementById("pwd");//id或者是name
element.InnerText = txt_pwd.Text; // 第一种情况butten 按钮有id或者name
HtmlElement buttonSubmit = this.webBrowser1.Document.GetElementById("submitBtn");
buttonSubmit.InvokeMember("click");
}
catch (Exception)
{ // throw;
}
//
herfclick("http://mail.qq.com/cgi-bin/frame_html?f=html&sid=rxOuQ-CEBfe1KCx4Uc-T5vNw");
} private void timer1_Tick(object sender, EventArgs e)
{
webBrowser1.Navigate(new Uri("https://w.mail.qq.com/cgi-bin/loginpage?f=xhtml"));
timer1.Stop();
} private void timer2_Tick(object sender, EventArgs e)
{
try
{
// i++;
//if (i > listBox1.Items.Count)
//{
// MessageBox.Show("全部已打开一次");
// return;
//}
//txt_uid.Text = listBox1.Items[i].ToString().Replace("----", "-").Split('-')[0];
//txt_pwd.Text = listBox1.Items[i].ToString().Replace("----", "-").Split('-')[1]; HtmlDocument cd = webBrowser1.Document;
HtmlElement element = webBrowser1.Document.GetElementById("uin");//id或者是name
element.InnerText = txt_uid.Text;
element = webBrowser1.Document.GetElementById("pwd");//id或者是name
element.InnerText = txt_pwd.Text; // 第一种情况butten 按钮有id或者name
HtmlElement buttonSubmit = this.webBrowser1.Document.GetElementById("submitBtn");
buttonSubmit.InvokeMember("click");
}
catch (Exception)
{ // throw;
}
timer2.Stop();
} private void timer3_Tick(object sender, EventArgs e)
{
//模拟点击某个链接
herfclick("http://mail.qq.com/cgi-bin/frame_html?f=html&sid=rxOuQ-CEBfe1KCx4Uc-T5vNw");
timer3.Stop();
} private void button9_Click(object sender, EventArgs e)
{
timer1.Start();
timer2.Start();
timer3.Start(); } private void timer4_Tick(object sender, EventArgs e)
{
//模拟点击某个链接
herfclick("http://mail.qq.com/cgi-bin/frame_html?f=html&sid=rxOuQ-CEBfe1KCx4Uc-T5vNw");
// timer4.Stop();
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Threading;
using System.IO; namespace WindowsFormsApplication1
{
public partial class Form4 : Form
{
public Form4()
{
InitializeComponent(); }
void mouse_OnMouseActivity(object sender, MouseEventArgs e)
{
string str = "X:" + e.X + " Y:" + e.Y;
this.Text = str;
}
#region API单击
[DllImport("user32.dll", SetLastError = true)]
private static extern IntPtr GetWindow(IntPtr hWnd, uint uCmd);
[DllImport("user32.dll", CharSet = CharSet.Auto)]
private static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);
private void DoMouseClick(int ex, int ey)
{
IntPtr handle = this.webBrowser1.Handle;
StringBuilder lpClassName = new StringBuilder();
while (lpClassName.ToString() != "Internet Explorer_Server")
{
handle = GetWindow(handle, );
GetClassName(handle, lpClassName, lpClassName.Capacity);
}
IntPtr lParam = (IntPtr)((ey << 0x10) | ex);
IntPtr zero = IntPtr.Zero;
SendMessage(handle, 0x201, zero, lParam);
SendMessage(handle, 0x202, zero, lParam);
}
private void DoMouseClick(IntPtr handle, int ex, int ey)
{
StringBuilder lpClassName = new StringBuilder();
while (lpClassName.ToString() != "Internet Explorer_Server")
{
handle = GetWindow(handle, );
GetClassName(handle, lpClassName, lpClassName.Capacity);
}
IntPtr lParam = (IntPtr)((ey << 0x10) | ex);
IntPtr zero = IntPtr.Zero;
SendMessage(handle, 0x201, zero, lParam);
SendMessage(handle, 0x202, zero, lParam);
}
[DllImport("user32.dll", CharSet = CharSet.Auto)]
private static extern int GetClassName(IntPtr hWnd, StringBuilder lpClassName, int nMaxCount);
#endregion int i = ;
private void Form4_Load(object sender, EventArgs e)
{
txt_uid.Text = listBox1.Items[].ToString().Replace("----", "-").Split('-')[];
txt_pwd.Text = listBox1.Items[].ToString().Replace("----", "-").Split('-')[];
//timer1.Interval = 20;
//timer1.Interval = 1000;
//timer1.Interval = 2000;
}
MouseHook mouse = new MouseHook();
private void button1_Click(object sender, EventArgs e)
{ try
{
// i++;
//if (i > listBox1.Items.Count)
//{
// MessageBox.Show("全部已打开一次");
// return;
//}
//txt_uid.Text = listBox1.Items[i].ToString().Replace("----", "-").Split('-')[0];
//txt_pwd.Text = listBox1.Items[i].ToString().Replace("----", "-").Split('-')[1]; HtmlDocument cd = webBrowser1.Document;
HtmlElement element = webBrowser1.Document.GetElementById("uin");//id或者是name
element.InnerText = txt_uid.Text;
element = webBrowser1.Document.GetElementById("pwd");//id或者是name
element.InnerText = txt_pwd.Text; // 第一种情况butten 按钮有id或者name
HtmlElement buttonSubmit = this.webBrowser1.Document.GetElementById("submitBtn");
buttonSubmit.InvokeMember("click");
}
catch (Exception)
{ // throw;
} } private void button2_Click(object sender, EventArgs e)
{
webBrowser1.Navigate(new Uri("https://w.mail.qq.com/cgi-bin/loginpage?f=xhtml"));
} private void button3_Click(object sender, EventArgs e)
{
Rectangle rt = webBrowser1.Document.Body.ScrollRectangle;
webBrowser1.Document.Window.ScrollTo(, rt.Height);
} private void button5_Click(object sender, EventArgs e)
{
i++;
if (i > listBox1.Items.Count)
return;
txt_uid.Text = listBox1.Items[i].ToString().Replace("----", "-").Split('-')[];
txt_pwd.Text = listBox1.Items[i].ToString().Replace("----", "-").Split('-')[];
} private void button6_Click(object sender, EventArgs e)
{
listBox1.Items.Clear();
Read("1.txt");
labcout.Text = "总共:"+listBox1.Items.Count.ToString();
i = ;
}
public void Read(string path)
{
StreamReader sr = new StreamReader(path, Encoding.Default);
String line;
while ((line = sr.ReadLine()) != null)
{
listBox1.Items.Add(line.ToString());
}
} private void button7_Click(object sender, EventArgs e)
{
//HtmlElementCollection link = this.webBrowser1.Document.GetElementsByTagName("a");
// for (int ii = 0; ii < link.Count; ii++)
// {
// if (link[ii].GetAttribute("href").ToLower().IndexOf("http://mail.qq.com/cgi-bin/frame_html?") == 0 && link[ii].GetAttribute("href").ToLower().IndexOf("&st=0&p=") > 0) // link[ii].InvokeMember("click");
// }
herfclick("http://mail.qq.com/cgi-bin/frame_html?f=html&sid=rxOuQ-CEBfe1KCx4Uc-T5vNw");
// http://mail.qq.com/cgi-bin/frame_html?f=html&sid=9YMxbM2xOc2PCHMnUfnT5vNw
}
private void herfclick(string url)
{ for (int i = ; i < webBrowser1.Document.All.Count; i++)
{
if (webBrowser1.Document.All[i].GetAttribute("href").ToString().Trim().Length > )
{
if (webBrowser1.Document.All[i].TagName == "A" && webBrowser1.Document.All[i].GetAttribute("href").ToString().Trim().Substring(, ) == url.Substring(, ))
{ webBrowser1.Document.All[i].InvokeMember("click");//引发”CLICK”事件 break; }
}
} } private void listBox1_Click(object sender, EventArgs e)
{
txt_uid.Text =listBox1.Items[listBox1.SelectedIndex].ToString().Replace("----", "-").Split('-')[];
txt_pwd.Text = listBox1.Items[listBox1.SelectedIndex].ToString().Replace("----", "-").Split('-')[];
timer1.Start();
timer2.Start();
timer3.Start();
timer4.Start();
} private void button8_Click(object sender, EventArgs e)
{
//
webBrowser1.Navigate(new Uri("https://w.mail.qq.com/cgi-bin/loginpage?f=xhtml"));
Thread.Sleep();
Rectangle rt = webBrowser1.Document.Body.ScrollRectangle;
webBrowser1.Document.Window.ScrollTo(, rt.Height);
//
try
{
// i++;
//if (i > listBox1.Items.Count)
//{
// MessageBox.Show("全部已打开一次");
// return;
//}
//txt_uid.Text = listBox1.Items[i].ToString().Replace("----", "-").Split('-')[0];
//txt_pwd.Text = listBox1.Items[i].ToString().Replace("----", "-").Split('-')[1]; HtmlDocument cd = webBrowser1.Document;
HtmlElement element = webBrowser1.Document.GetElementById("uin");//id或者是name
element.InnerText = txt_uid.Text;
element = webBrowser1.Document.GetElementById("pwd");//id或者是name
element.InnerText = txt_pwd.Text; // 第一种情况butten 按钮有id或者name
HtmlElement buttonSubmit = this.webBrowser1.Document.GetElementById("submitBtn");
buttonSubmit.InvokeMember("click");
}
catch (Exception)
{ // throw;
}
//
herfclick("http://mail.qq.com/cgi-bin/frame_html?f=html&sid=rxOuQ-CEBfe1KCx4Uc-T5vNw");
} private void timer1_Tick(object sender, EventArgs e)
{
webBrowser1.Navigate(new Uri("https://w.mail.qq.com/cgi-bin/loginpage?f=xhtml"));
timer1.Stop();
} private void timer2_Tick(object sender, EventArgs e)
{
try
{
// i++;
//if (i > listBox1.Items.Count)
//{
// MessageBox.Show("全部已打开一次");
// return;
//}
//txt_uid.Text = listBox1.Items[i].ToString().Replace("----", "-").Split('-')[0];
//txt_pwd.Text = listBox1.Items[i].ToString().Replace("----", "-").Split('-')[1]; HtmlDocument cd = webBrowser1.Document;
HtmlElement element = webBrowser1.Document.GetElementById("uin");//id或者是name
element.InnerText = txt_uid.Text;
element = webBrowser1.Document.GetElementById("pwd");//id或者是name
element.InnerText = txt_pwd.Text; // 第一种情况butten 按钮有id或者name
HtmlElement buttonSubmit = this.webBrowser1.Document.GetElementById("submitBtn");
buttonSubmit.InvokeMember("click");
}
catch (Exception)
{ // throw;
}
timer2.Stop();
} private void timer3_Tick(object sender, EventArgs e)
{
//模拟点击某个链接
herfclick("http://mail.qq.com/cgi-bin/frame_html?f=html&sid=rxOuQ-CEBfe1KCx4Uc-T5vNw");
timer3.Stop();
} private void button9_Click(object sender, EventArgs e)
{
timer1.Start();
timer2.Start();
timer3.Start(); } private void timer4_Tick(object sender, EventArgs e)
{
//模拟点击某个链接
herfclick("http://mail.qq.com/cgi-bin/frame_html?f=html&sid=rxOuQ-CEBfe1KCx4Uc-T5vNw");
// timer4.Stop();
}
}
}

最新文章

  1. NK3C系统中ID的汉语名称
  2. C# 中的virtural和abstract
  3. HDU 5833 Zhu and 772002
  4. 爬虫再探实战(三)———爬取动态加载页面——selenium
  5. struts2+jquery 实现ajax登陆
  6. Load PE from memory(反取证)(未完)
  7. 解决cookie 跨iframe
  8. trait与policy模板应用简单示例
  9. POJ - 2828
  10. Spring Boot:The field file exceeds its maximum permitted size of 1048576 bytes
  11. [TC]Total Command显示文件夹大小
  12. BZOJ3277 串 【后缀数组】【二分答案】【主席树】
  13. svg画弧
  14. Android.PublishApplication
  15. C#的TextBox获取行高
  16. TS流解析 一
  17. des,原理待续
  18. 一个CXF集成SPRING的WEBSERVICE完整实例
  19. 使用ffmpeg将海康视频rtsp转为hls
  20. gitlab通过api创建组、项目、成员

热门文章

  1. Android开发——Activity生命周期
  2. luogu4035 [JSOI2008]球形空间产生器
  3. JavaEE JDBC 了解数据库连接池
  4. K/3Cloud二次开发基于WebDev附加进程调试
  5. 旅行(bzoj 3531)
  6. .NET Core 3.0之深入源码理解Configuration(一)
  7. 《springMVC》学习笔记
  8. 关于MSSQL的decimal(numeric)、money、float的使用以及区别
  9. 学习swift从青铜到王者之swift枚举07
  10. 核函数以及SVM相关知识(重点)