QQ游戏自动登录器,源代码(仅供参考)

新的游戏大厅已经Fix了这个BUG

现将代码公布,抛转引玉!

using  System;
using  System.Drawing;
using  System.Collections;
using  System.ComponentModel;
using  System.Windows.Forms;
using  System.Data;
using  System.Runtime.InteropServices;
using  System.Threading; // Thread;
using  System.Management;
// using CustomUIControls;
// using System.Net;
using  System.IO;
// using System.Xml;
// using Sloppycode.net;


namespace  QQ自动登录器
{
    
/// <summary>
    
/// Form1 的摘要说明。
    
/// </summary>

    public class Form1 : System.Windows.Forms.Form
    
{

        [DllImport(
"user32.dll")]
        
static extern bool SetCursorPos(int X, int Y); 
        
//模拟鼠标
        private readonly int MOUSEEVENTF_LEFTDOWN = 0x2;
        
private System.Windows.Forms.TextBox textBox1;
        
private System.Windows.Forms.Label label1;
        
private System.Windows.Forms.TextBox textBox2;
        
private System.Windows.Forms.Label label2;
        
private System.Windows.Forms.ListBox listBox1;
        
private System.Windows.Forms.Button button1;
        
private System.Windows.Forms.TextBox textBox3;
        
private System.Windows.Forms.Button button2;
        
private System.Windows.Forms.Label label3;
        
int NUM=9999;
        
int N=0;
        
string MP1="",MP2="";
        
public string Url="";
        
private System.Windows.Forms.Label label4;
        
private System.Windows.Forms.Timer waittimer;
        
private System.Windows.Forms.Button button3;
        
private readonly int MOUSEEVENTF_LEFTUP = 0x4;
        [DllImport(
"user32")]
        
public static extern void mouse_event(int dwFlags, int dx, int dy, int dwData, int dwExtraInfo);
        
//--------
        [DllImport("user32.dll")]
        
static extern void keybd_event(
            
byte bVk, 
            
byte bScan, 
            
uint dwFlags, 
            
uint dwExtraInfo
            );


        
private System.Windows.Forms.Button autologinbutton;
        
private System.ComponentModel.IContainer components;

        
public Form1()
        
{
            
//
            
// Windows 窗体设计器支持所必需的
            
//
            InitializeComponent();

            
//
            
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
            
//
        }


        
/// <summary>
        
/// 清理所有正在使用的资源。
        
/// </summary>

        protected override void Dispose( bool disposing )
        
{
            
if( disposing )
            
{
                
if (components != null
                
{
                    components.Dispose();
                }

            }

            
base.Dispose( disposing );
        }


        
Windows 窗体设计器生成的代码

        
/// <summary>
        
/// 应用程序的主入口点。
        
/// </summary>

        [STAThread]
        
static void Main() 
        
{
            Application.Run(
new Form1());
        }

        
void process()
        
{
            
//Application.
            System.Diagnostics.Process  Proc  ;
            System.Diagnostics.ProcessStartInfo  Info  
=  new  System.Diagnostics.ProcessStartInfo();
            Info.FileName
=@Url;
            Proc  
=  System.Diagnostics.Process.Start(Info);


            
int X=500,Y=341;
            SetCursorPos(X,Y);
            mouse_event(MOUSEEVENTF_LEFTDOWN , 
0 , 0 , 00);
            mouse_event(MOUSEEVENTF_LEFTUP, 
0 , 0 , 00);
            
//SendKeys.Send("{A}");

            
//mouse_event(MOUSEEVENTF_LEFTUP, X * 65536 / 1024, Y * 65536 / 768, 0, 0);
            
//mouse_event(MOUSEEVENTF_RightDown, X * 65536 / 1024, Y * 65536 / 768, 0, 0);
            
//mouse_event(MOUSEEVENTF_RightUp, X * 65536 / 1024, Y * 65536 / 768, 0, 0);
            


            
//mouse_event(MOUSEEVENTF_LEFTDOWN, X, Y, 0, 0);
            
//mouse_event(MOUSEEVENTF_LEFTUP, X, Y, 0, 0);
            
//其中X,Y分别是你要点击的点的横坐标和纵坐标

        }


        
public void newthread(string uname,string password)
        
{
            

        }

        
private void autologinbutton_Click(object sender, System.EventArgs e)
        
{
            
//process();


            
//Thread thread = new Thread(new ThreadStart(processnew));
            
//thread.Start();
            processnew();

        }

        
void processnew()
        
{//读取QQ号和密码
            
//自动打开游戏大厅
            System.Diagnostics.Process  Proc;
            System.Diagnostics.ProcessStartInfo  Info  
=  new  System.Diagnostics.ProcessStartInfo();
            Info.FileName
=textBox3.Text;
            Proc  
=  System.Diagnostics.Process.Start(Info);
            
            
            Proc.WaitForInputIdle();
//---------------------
            int X=457,Y=390;
            SetCursorPos(X,Y);

            mouse_event(MOUSEEVENTF_LEFTDOWN , 
0 , 0 , 00);
            mouse_event(MOUSEEVENTF_LEFTUP, 
0 , 0 , 00);
            

            
//Proc.WaitForInputIdle();
//--------------------
            string txt1=textBox1.Text;
            
for(int i=0;i<textBox1.Text.Length;i++)
            
{
                
string a=txt1.Substring(i,1);
                a
="{"+a+"}";
                
//MessageBox.Show(a);
                SendKeys.Send(a);


            }


            Proc.WaitForInputIdle();
            SendKeys.Send(
"{TAB}");
            
//X=463;Y=419;
            
//SetCursorPos(X,Y);
            
//mouse_event(MOUSEEVENTF_LEFTDOWN , 0 , 0 , 0, 0);
            
//mouse_event(MOUSEEVENTF_LEFTUP, 0 , 0 , 0, 0);
            
            
            
            
            
string txt2=textBox2.Text;
        
            
for(int i=0;i<textBox2.Text.Length;i++)
            
{
                
string a=txt2.Substring(i,1);
                a
="{"+a+"}";
                SendKeys.Send(a);


            }

            



            


            
//for(int k=1;k<=11;k++)
            
//{
                
//SendKeys.Send("{TAB}");
            
//}
            SendKeys.Send("{Enter}");
            
//Proc.CloseMainWindow();
            SendKeys.Send("%{Tab}");
            
//SendKeys.Send("{N}");





            
//Proc.WaitForInputIdle();
            
//X=969;Y=8;
            
//SetCursorPos(X,Y);
            
//mouse_event(MOUSEEVENTF_LEFTDOWN , 0 , 0 , 0, 0);
            
//mouse_event(MOUSEEVENTF_LEFTUP, 0 , 0 , 0, 0);

            
//mouse_event(MOUSEEVENTF_LEFTDOWN , 0 , 0 , 0, 0);
            
//mouse_event(MOUSEEVENTF_LEFTUP, 0 , 0 , 0, 0);



            waittimer.Start();
            
//MessageBox.Show("chulai");









        }

        

        
void getCUPinfo()
        
{
            
string cpuInfo = "";//cpu序列号
            ManagementClass cimobject = new
            ManagementClass(
"Win32_Processor");
            ManagementObjectCollection moc 
= cimobject.GetInstances();
            
foreach(ManagementObject mo in moc)
            
{
                cpuInfo 
= mo.Properties["ProcessorId"].Value.ToString();
                MessageBox.Show(cpuInfo);
            }
 
        }

        
private void Form1_Load(object sender, System.EventArgs e)
        
{

            label4.Text
="使用我的方法:先指定QQGame.exe的存放路径,然后选取你的密码文件,双击密码文件即可自动登录,如果有登陆不成功的地方,可能由于网络问题,请多试几次!我的主人是NOIR";
            info   dlg   
=   new info();//对话框   
            dlg.ShowDialog();  
       
            
//int NUM=dlg.label3.Text
            
//MessageBox.Show(dlg.label3.Text);
            string Snum=dlg.label3.Text;
            
if(Snum=="")
            
{
                
            }

            
else
            
{
                NUM
=5;
                label3.Text
+="  试用版本";
                


            }


            
            
            
//process();
            
//getCUPinfo();
            
//this.Cursor = Cursors.WaitCursor;
            
//Thread thread = new Thread(new ThreadStart(Loadtxt));
            
//thread.Start();
            
//this.Cursor = Cursors.Default;

        }


        
private void listBox1_DoubleClick(object sender, System.EventArgs e)
        
{
            
//int count=listBox1.SelectedItems.Count;

            
//for(int y=0;y<2;y++)
            
//{

            





                
string MP=listBox1.SelectedItem.ToString().Trim();
                
int i=0,j=0,flag=0;
                i
=MP.IndexOf("----",i);//i=Code.IndexOf("<font color="red">",i);


                
//textBox1.Text=MP.Substring(0,i);


                
//textBox2.Text=MP.Substring(i+4,MP.Length-i-4);

            
            
                j
=MP.IndexOf("----",i+4);
                
//MessageBox.Show(j.ToString());
                if(j==-1)
                
{
                    flag
=1;
                }

                
else 
                
{
                    flag
=2;
                }

            
            
            

                
if(flag==1)
                
{
                    textBox1.Text
=MP.Substring(0,i);


                    textBox2.Text
=MP.Substring(i+4,MP.Length-i-4);
                    
///MessageBox.Show("flag==1");

                    
//processnew();
                }

                
else if(flag==2)
                
{
                    textBox1.Text
=MP.Substring(0,i);


                    textBox2.Text
=MP.Substring(i+4,j-i-4);
                    
//MessageBox.Show("flag==2");
                    
//processnew();

                }



                
int po=listBox1.SelectedIndex;
                
string sss=listBox1.SelectedItem.ToString()+"----*";//listBox1.SelectedIndex
                listBox1.Items.RemoveAt(po);
                listBox1.Items.Insert(po,sss);

                processnew();



            
//waittimer.Start();
            
//waittimer.Stop();

            
//}

        }


        
private void button1_Click(object sender, System.EventArgs e)
        
{
            
int X=457,Y=390;
            SetCursorPos(X,Y);

            mouse_event(MOUSEEVENTF_LEFTDOWN , 
0 , 0 , 00);
            mouse_event(MOUSEEVENTF_LEFTUP, 
0 , 0 , 00);
            mouse_event(MOUSEEVENTF_LEFTDOWN , 
0 , 0 , 00);
            mouse_event(MOUSEEVENTF_LEFTUP, 
0 , 0 , 00);
            SendKeys.Send(
"{1}");

        
        }


        
private void button1_Click_1(object sender, System.EventArgs e)
        
{
            listBox1.Items.Clear();
            
            
if(textBox3.Text.Length==0)
            
{
                MessageBox.Show(
"请确定QQGame.exe的路径!");
            }

            OpenFileDialog openFileDialog 
= new OpenFileDialog(); 

            openFileDialog.Filter 
= " 文本文件(*.txt)|*.txt| 所有合适文件(*.txt)|*.txt"
            
if(DialogResult.OK == openFileDialog.ShowDialog()) 

            

                
//MessageBox.Show(openFileDialog.FileName);
                string sname=openFileDialog.FileName;
                StreamReader objReader 
= new StreamReader(sname);
                
string sLine="";
                
//ArrayList arrText = new ArrayList();

                
//int count=0;
                
//int num=0;
                
//string QQ="";

                sLine 
= objReader.ReadLine();
                
while (sLine != null&&NUM!=0)
                
{
                    listBox1.Items.Add(sLine);
                    sLine 
= objReader.ReadLine();
                    NUM
--;
                }



            }

        }


        
private void button2_Click(object sender, System.EventArgs e)
        
{
            OpenFileDialog openFileDialog 
= new OpenFileDialog(); 

            openFileDialog.Filter 
= " QQgame(QQgame.exe)| QQgame.exe"
            
if(DialogResult.OK == openFileDialog.ShowDialog()) 
            
{
                Url
=openFileDialog.FileName;
                textBox3.Text
=openFileDialog.FileName;
            }

        
        }


        
private void listBox1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
        
{
            
//鼠标按下时

            
string MP=listBox1.SelectedItem.ToString().Trim();
            
int i=0,j=0,flag=0;
            i
=MP.IndexOf("----",i);//i=Code.IndexOf("<font color="red">",i);


            
//textBox1.Text=MP.Substring(0,i);


            
//textBox2.Text=MP.Substring(i+4,MP.Length-i-4);

            
            
            j
=MP.IndexOf("----",i+4);
            
//MessageBox.Show(j.ToString());
            if(j==-1)
            
{
                flag
=1;
            }

            
else 
            
{
                flag
=2;
            }

            
            
            

            
if(flag==1)
            
{
                textBox1.Text
=MP.Substring(0,i);


                textBox2.Text
=MP.Substring(i+4,MP.Length-i-4);
                
///MessageBox.Show("flag==1");

            }

            
else if(flag==2)
            
{
                textBox1.Text
=MP.Substring(0,i);


                textBox2.Text
=MP.Substring(i+4,j-i-4);
                
//MessageBox.Show("flag==2");
                

            }

        }


        
private void button3_Click(object sender, System.EventArgs e)
        
{
            
//批量登陆
            N=listBox1.SelectedItems.Count;//取选了多少数
            waittimer.Start();
        }


        
private void waittimer_Tick(object sender, System.EventArgs e)
        
{
            
            
            
//for(int ii=0;ii<N;i++)
            
//{
            N--;
            
if(N<0)
            
{
                waittimer.Stop();
                
return;
            }

            MP1
=listBox1.SelectedItems[N].ToString().Trim();
            
int i=0,j=0,flag=0;
            i
=MP1.IndexOf("----",i);
            j
=MP1.IndexOf("----",i+4);
            
if(j==-1)
            
{
                flag
=1;
            }

            
else 
            
{
                flag
=2;
            }

            
if(flag==1)
            
{
                textBox1.Text
=MP1.Substring(0,i);


                textBox2.Text
=MP1.Substring(i+4,MP1.Length-i-4);
                
            }

            
else if(flag==2)
            
{
                textBox1.Text
=MP1.Substring(0,i);


                textBox2.Text
=MP1.Substring(i+4,j-i-4);

                    
                

            }



            processnew();
        }


    }

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值