using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using System.Text.RegularExpressions;
using System.Runtime.InteropServices;
namespace 网站访问量
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
string x = textBox1.Text;
if (x == "") {
MessageBox.Show("照照,网址不能为空!");
return;
}
xx();
timer1.Enabled = true;
button1.Enabled = false;
button2.Enabled = true;
}
public void xx() {
string x = textBox1.Text;
Regex reg = new Regex(@",");
string[] r = reg.Split(x);
Process ps = new Process();
ps.StartInfo.FileName = "iexplore.exe";
for (int i = 0; i < r.Length; i++)
{
//ps.StartInfo.Arguments = "" + r[i] + "";
//ps.Start();
System.Diagnostics.Process.Start(""+r[i]+"");
}
}
private void timer1_Tick(object sender, EventArgs e)
{
xx();
}
private void button2_Click(object sender, EventArgs e)
{
timer1.Enabled = false;
button2.Enabled = false;
button1.Enabled = true;
}
private void button3_Click(object sender, EventArgs e)
{
if (textBox2.Text == "") {
MessageBox.Show("设定时间不能为空");
return;
}
int x=Convert.ToInt32( textBox2.Text)*1000;
timer1.Interval = x;
}
private void Form1_Load(object sender, EventArgs e)
{
button2.Enabled = false;
}
private void button4_Click(object sender, EventArgs e)
{
if (textBox3.Text == "")
{
MessageBox.Show("设定时间不能为空");
return;
}
timer2.Interval = Convert.ToInt32(textBox3.Text) * 60000;
}
private void timer2_Tick(object sender, EventArgs e)
{
Process[] myProcess;
myProcess = Process.GetProcessesByName("iexplore");
foreach (Process instance in myProcess)
{
instance.WaitForExit(3);
instance.CloseMainWindow();
}
}
}
}