C#QQ号批量注册(一)

 

QQ号批量注册首先要实现自动换IP的功能,我的方法是让机器自动重新拨号,即可实现自动换IP,实现方法是建一个ADSL类。从中调用,实现,换断网,重新拨号。

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;//诊断,调用进程

 

namespace QQ号批量注册
{
    class ADSLHelper
    {

 

        public void Connect(string connectionName, string user, string pass)
        {
            string arg = string.Format("rasdial \"{0}\" {1} {2}", connectionName, user, pass);
            InvokeCmd(arg);
        }
        public void Disconnect(string connectionName)
        {
            string arg = string.Format("rasdial \"{0}\" /disconnect", connectionName);
            InvokeCmd(arg);
        }
        public  static string InvokeCmd(string cmdArgs)
        {
            Process p = new Process();
            p.StartInfo.FileName = "cmd.exe";
            p.StartInfo.UseShellExecute = false;
            p.StartInfo.RedirectStandardInput = true;
            p.StartInfo.RedirectStandardOutput = true;
            p.StartInfo.RedirectStandardError = true;
            p.StartInfo.CreateNoWindow = true;
            p.Start();
            p.StandardInput.WriteLine(cmdArgs);
            p.StandardInput.WriteLine("exit");
            return p.StandardOutput.ReadToEnd();
        }

 

    }
}

转载请注明出处:http://www.cnblogs.com/minotmin/

 

posted on 2012-09-23 23:39  程序猴chengxuhou.com  阅读(942)  评论(0编辑  收藏  举报

导航