请问各位,如何编写QQ登录程序?望给出代码~ 谁会有QQ的登陆程序?谁会把QQ的代码发出来?.....关注一下 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 连接数据库不就好了吗,这是主窗口,using System;using System.Drawing;using System.Collections;using System.ComponentModel;using System.Windows.Forms;using System.Data;using System.Threading;using System.Data.SqlClient;using Qtest;namespace QConnectSql{ /// <summary> /// Form1 的摘要说明。 /// </summary> public class Form1 : System.Windows.Forms.Form {// private Form2 newForm2; private System.Windows.Forms.Button butSubmit; private System.Windows.Forms.ComboBox comNumber; private System.Windows.Forms.TextBox txtPassword; private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label2; private System.Windows.Forms.Button butRegedit; #region 自己定义的变量 private string LoginNumber; private string LoginPassword; private SqlConnection objConnection; private SqlDataAdapter objDataAdapter; private DataSet mySet; #endregion /// <summary> /// 必需的设计器变量。 /// </summary> private System.ComponentModel.Container components = null; public Form1() {// Form1 f;// f = this;//************把本身的指针传给f // // Windows 窗体设计器支持所必需的 // InitializeComponent(); //newForm2 = new Form2(f);//*************把指针传到Form2中去 // // TODO: 在 InitializeComponent 调用后添加任何构造函数代码 // } /// <summary> /// 清理所有正在使用的资源。 /// </summary> protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Windows 窗体设计器生成的代码 /// <summary> /// 设计器支持所需的方法 - 不要使用代码编辑器修改 /// 此方法的内容。 /// </summary> private void InitializeComponent() { this.butSubmit = new System.Windows.Forms.Button(); this.comNumber = new System.Windows.Forms.ComboBox(); this.txtPassword = new System.Windows.Forms.TextBox(); this.label1 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.butRegedit = new System.Windows.Forms.Button(); this.SuspendLayout(); // // butSubmit // this.butSubmit.Location = new System.Drawing.Point(96, 200); this.butSubmit.Name = "butSubmit"; this.butSubmit.TabIndex = 0; this.butSubmit.Text = "Submit"; this.butSubmit.Click += new System.EventHandler(this.button1_Click); // // comNumber // this.comNumber.Location = new System.Drawing.Point(120, 64); this.comNumber.Name = "comNumber"; this.comNumber.Size = new System.Drawing.Size(200, 20); this.comNumber.TabIndex = 1; // // txtPassword // this.txtPassword.Location = new System.Drawing.Point(120, 120); this.txtPassword.Name = "txtPassword"; this.txtPassword.Size = new System.Drawing.Size(200, 21); this.txtPassword.TabIndex = 2; this.txtPassword.Text = ""; this.txtPassword.PasswordChar = '*'; // // label1 // this.label1.Location = new System.Drawing.Point(8, 64); this.label1.Name = "label1"; this.label1.TabIndex = 3; this.label1.Text = "Number"; // // label2 // this.label2.Location = new System.Drawing.Point(8, 120); this.label2.Name = "label2"; this.label2.TabIndex = 4; this.label2.Text = "Password"; // // butRegedit // this.butRegedit.Location = new System.Drawing.Point(224, 200); this.butRegedit.Name = "butRegedit"; this.butRegedit.TabIndex = 5; this.butRegedit.Text = "Regedit"; // // Form1 // this.AutoScaleBaseSize = new System.Drawing.Size(6, 14); this.ClientSize = new System.Drawing.Size(368, 253); this.Controls.Add(this.butRegedit); this.Controls.Add(this.label2); this.Controls.Add(this.label1); this.Controls.Add(this.txtPassword); this.Controls.Add(this.comNumber); this.Controls.Add(this.butSubmit); this.Name = "Form1"; this.Text = "MyChat"; this.ResumeLayout(false); } #endregion /// <summary> /// 应用程序的主入口点。 /// </summary> [STAThread] static void Main() { Application.Run(new Form1()); } private void button1_Click(object sender, System.EventArgs e) { //newForm2.Show(); //this.Hide();//隐藏控件(可以时窗口或者其他的控件) this.LoginNumber = this.comNumber.Text;//获取用户名 this.LoginPassword = this.txtPassword.Text;//获取密码 string strSql = "if exists (select * from Login where userID='"+this.LoginNumber +"' and userPassword= '"+this.LoginPassword+"') select 1 else select 0 "; //判断是否是已经注册的号码和正确的密码 string strConnection = "server=jjh;uid=sa;password=sa;database=MyChat"; objConnection = new SqlConnection(strConnection); //objDataAdapter = new SqlDataAdapter(strSql,objConnection); SqlCommand objCommand = new SqlCommand(strSql,objConnection); objConnection.Open(); string number = "OK"; try { number = objCommand.ExecuteScalar().ToString(); } catch(Exception f) { MessageBox.Show(f.Message); } if("1" == number ) { MessageBox.Show("OK"); } else { MessageBox.Show("Sorry"+number); } // mySet = new DataSet();// objDataAdapter.Fill(mySet); //this. } }}你可以建立一个副窗口在MessgaeBox.show("OK");那里可以显示你创建的副窗口,哪就好了,,显示副窗口后,就隐藏主窗口了,, 没用的。QQ应该会把用户名和密码加密了再发到服务器中验证的,而且为了防范攻击,在发送的结构体中一定还有好多的验证。否则QQ服务器不会验证的。试想一下谁都可以发到QQ登录的验证包到它的服务器中验证。它的服务器早就完了。 好像没有能直接登陆QQ服务器的!MSN,ICQ的倒很多的 不知道lumaqq这方面怎么做的有代码,可惜看不懂~ WPF 控件内容拖放问题 问题,关于正则表达式 datagridView 绑定txt文本中数据求解?急急急急急急急急 如何将对象保存进SQLSERVER 关于标题栏的制作 关于读取DBF格式文件的问题 求 .NET2005 MSDN Library 关于Windows Form的Size和DesktopLocation 关于datagrid的更新功能的问题 C# 打印机纸张设置 一个很简单的数组问题 怎么调用SQL Server中的存储过程?
这是主窗口,
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Threading;
using System.Data.SqlClient;
using Qtest;
namespace QConnectSql
{
/// <summary>
/// Form1 的摘要说明。
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
// private Form2 newForm2;
private System.Windows.Forms.Button butSubmit;
private System.Windows.Forms.ComboBox comNumber;
private System.Windows.Forms.TextBox txtPassword;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Button butRegedit;
#region 自己定义的变量
private string LoginNumber;
private string LoginPassword;
private SqlConnection objConnection;
private SqlDataAdapter objDataAdapter;
private DataSet mySet;
#endregion
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public Form1()
{
// Form1 f;
// f = this;//************把本身的指针传给f
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//newForm2 = new Form2(f);//*************把指针传到Form2中去
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
} /// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
} #region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.butSubmit = new System.Windows.Forms.Button();
this.comNumber = new System.Windows.Forms.ComboBox();
this.txtPassword = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.butRegedit = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// butSubmit
//
this.butSubmit.Location = new System.Drawing.Point(96, 200);
this.butSubmit.Name = "butSubmit";
this.butSubmit.TabIndex = 0;
this.butSubmit.Text = "Submit";
this.butSubmit.Click += new System.EventHandler(this.button1_Click);
//
// comNumber
//
this.comNumber.Location = new System.Drawing.Point(120, 64);
this.comNumber.Name = "comNumber";
this.comNumber.Size = new System.Drawing.Size(200, 20);
this.comNumber.TabIndex = 1;
//
// txtPassword
//
this.txtPassword.Location = new System.Drawing.Point(120, 120);
this.txtPassword.Name = "txtPassword";
this.txtPassword.Size = new System.Drawing.Size(200, 21);
this.txtPassword.TabIndex = 2;
this.txtPassword.Text = "";
this.txtPassword.PasswordChar = '*';
//
// label1
//
this.label1.Location = new System.Drawing.Point(8, 64);
this.label1.Name = "label1";
this.label1.TabIndex = 3;
this.label1.Text = "Number";
//
// label2
//
this.label2.Location = new System.Drawing.Point(8, 120);
this.label2.Name = "label2";
this.label2.TabIndex = 4;
this.label2.Text = "Password";
//
// butRegedit
//
this.butRegedit.Location = new System.Drawing.Point(224, 200);
this.butRegedit.Name = "butRegedit";
this.butRegedit.TabIndex = 5;
this.butRegedit.Text = "Regedit";
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(368, 253);
this.Controls.Add(this.butRegedit);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.txtPassword);
this.Controls.Add(this.comNumber);
this.Controls.Add(this.butSubmit);
this.Name = "Form1";
this.Text = "MyChat";
this.ResumeLayout(false); }
#endregion /// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
} private void button1_Click(object sender, System.EventArgs e)
{
//newForm2.Show();
//this.Hide();//隐藏控件(可以时窗口或者其他的控件)
this.LoginNumber = this.comNumber.Text;//获取用户名
this.LoginPassword = this.txtPassword.Text;//获取密码
string strSql = "if exists (select * from Login where userID='"+this.LoginNumber
+"' and userPassword= '"+this.LoginPassword+"') select 1 else select 0 ";
//判断是否是已经注册的号码和正确的密码
string strConnection = "server=jjh;uid=sa;password=sa;database=MyChat";
objConnection = new SqlConnection(strConnection);
//objDataAdapter = new SqlDataAdapter(strSql,objConnection);
SqlCommand objCommand = new SqlCommand(strSql,objConnection);
objConnection.Open();
string number = "OK";
try
{
number = objCommand.ExecuteScalar().ToString();
}
catch(Exception f)
{
MessageBox.Show(f.Message);
}
if("1" == number )
{
MessageBox.Show("OK");
}
else
{
MessageBox.Show("Sorry"+number);
}
// mySet = new DataSet();
// objDataAdapter.Fill(mySet);
//this.
}
}
}
你可以建立一个副窗口
在MessgaeBox.show("OK");那里可以显示你创建的副窗口,哪就好了,,
显示副窗口后,就隐藏主窗口了,,
的结构体中一定还有好多的验证。否则QQ服务器不会验证的。试想一下谁都可以发到QQ登录的
验证包到它的服务器中验证。它的服务器早就完了。