C#网页刷票器(实现代理IP投票)

本文介绍了一款使用C#编写的网页刷票器,该工具结合代理IP进行投票,适用于软件测试课程的作业。作者提供了PPT和源码下载链接,以及刷票效果的展示和实际刷票地址。
摘要由CSDN通过智能技术生成

和@陈宇翔的修行录忙了一个星期写了个刷票器来交软件测试课的作业

PPT不是很好传,放到资源里面去,PPT地址:

源码地址:http://download.csdn.net/detail/a8887396/5344103

投票效果:



刷票地址: (有效期半年)

http://mwangbobo.jingdianet.com/Default.aspx

主要代码:

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.IO;
using mshtml;
using System.Net;
using System.Runtime.InteropServices;

namespace 刷票
{
    public partial class Form1 : Form
    {

        [DllImport(@"wininet",
    SetLastError = true,
    CharSet = CharSet.Auto,
    EntryPoint = "InternetSetOption",
    CallingConvention = CallingConvention.StdCall)]

        //即时刷新IE设置
        public static extern bool InternetSetOption(
            int hInternet,
            int dmOption,
            IntPtr lpBuffer,
            int dwBufferLength
        );

        //是否可以连接到internet
        [DllImport("wininet.dll")] 
        public extern static bool InternetGetConnectedState(out int Description, int ReservedValue);
        //返回false就是能连接到internet
        public static bool IsConnectedToInternet() 
        {
            int Desc; return InternetGetConnectedState(out Desc, 0); 
        }




        int count_all = 0; //投票次数
        bool is_start = false; //开始标志
        bool is_interval = false; //是否使用时间间隔
        bool is_proxy = false;
      //  bool is_ip_changed = false;
        string url_str = "http://mwangbobo.jingdianet.com/Default.aspx";  //投票的指定网址
       // string url_str = "http://localhost:4128/WebSite1/Default.aspx";
        string file_path; //代理IP的文本路径
        string[] ip = new string[1024]; //代理IP
     //   string[] port = new string[1024]; //代理IP的端口
        int count_ip = 0; //代理IP个数
        

        public Form1()
        {
            InitializeComponent();
            webBrowser1.Navigate(url_str); //跳转到页面

        }


        /* ==================            投票模块                    ================== */
       

        //点击开始按钮
        private void btn_start_Click(object sender, EventArgs e)
        {
            if (!IsConnectedToInternet()) //检查网卡状态 是否连接到internet 如你把网线拔了就会出错, 不包括设置代理IP错误导致不能开网页的情况
            {
                MessageBox.Show("不能连接到internet");
                return;
            }

       //     if (is_start || webBrowser1.Url == null || webBrowser1.Url.ToString() != url_str) //开始之后不能再点开始无效 或者 当前页面不是投票页面无效
            {
       //    
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值