十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
说下思路
专注于为中小企业提供成都网站建设、做网站服务,电脑端+手机端+微信端的三站合一,更高效的管理,为中小企业荔城免费做网站提供优质的服务。我们立足成都,凝聚了一批互联网行业人才,有力地推动了成百上千企业的稳健成长,帮助中小企业通过网站建设实现规模扩充和转变。
一、设定qq登陆过程:调用qq,用sendkeys发送
Shell qq路径, vbMinimizedFocus
Sleep 1000
DoEvents
SendKeys "+{tab}"
SendKeys text1.text
SendKeys "{tab}"
SendKeys text2.text
SendKeys "{enter}"
二、用timer1调用每多长时间登陆qq过程并记录控制登了几个qq,登陆10个后timer1将不可用。
三、设定关闭程序函数
Private Function propatht(proname As String) As String
Dim objWMIService As Object
Dim colProcesslist As Object
Dim objProcess As Object
Set objWMIService = CreateObject("winmgmts:{impersonationLevel=Impersonate}!root\cimv2")
Set colProcesslist = objWMIService.ExecQuery("select * from win32_process where name=" Chr(39) proname Chr(39))
For Each objProcess In colProcesslist
propatht = objProcess.ExecutablePath
objProcess.Terminate '关闭程序
Next
End Function
四、用timer2,设频率100,调用关闭函数,关闭txplatform.exe
propatht("txplatform.exe")
添加叫microsoft internet controls的控件,然后画在窗体上,命名为Web1
在窗体的Load事件中添加代码:Web1.Navigate ""
你好:
Button+Label+ListBox等等啦
很多的啦~VB 其实也是可视化界面 所见即所得的一个软件。你QQ上面有几个控件再去VB工具箱里找 都有的!呵呵!
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Security.Cryptography;
using System.Diagnostics;
namespace QQLogin
{
public partial class QQLoginForm : Form
{
public QQLoginForm()
{
InitializeComponent();
}
UserInfo ui;
private void button1_Click(object sender, EventArgs e)
{
//单用户登陆
if (ui == null)
{
ui = new UserInfo();//如果没有提取出来对象,就创建一个
}
if (ui != null)
{
ui.Username = this.txtUser.Text.Trim();
ui.Password = this.txtPwd.Text;
ui.Type = this.cboType.Text == "正常" ? "41" : "40";
if (this.ValidateInput())
{//验证是否输入完全
if (string.IsNullOrEmpty(ui.Path))
{//判断是否有QQ路径,如果没有就打开对话框来选择一下
DialogResult dr = this.opfQQ.ShowDialog();
if (dr == DialogResult.OK)
{
ui.Path = opfQQ.FileName;//将选择的路径赋值给对象
this.LoginQQ(ui.Username, ui.Password, ui.Type, ui.Path);//登陆QQ
}
}
else
{
this.LoginQQ(ui.Username, ui.Password, ui.Type, ui.Path);
}
}
SerializeHelper.SerializeUserInfo(ui);//每次登陆都序列化保存一次
}
}
private bool ValidateInput()
{//验证是否输入完整
if (this.txtUser.Text == "")
{
this.txtUser.Focus();
return false;
}
else if(this.txtPwd.Text=="")
{
this.txtPwd.Focus();
return false;
}
return true;
}
private void LoginQQ(string user,string pwd,string type,string path)
{//登陆QQ的命令,通过CMD命令来执行
Process MyProcess = new Process();
//设定程序名
MyProcess.StartInfo.FileName = "cmd.exe";
//关闭Shell的使用
MyProcess.StartInfo.UseShellExecute = false;
//重定向标准输入
MyProcess.StartInfo.RedirectStandardInput = true;
//重定向标准输出
MyProcess.StartInfo.RedirectStandardOutput = true;
//重定向错误输出
MyProcess.StartInfo.RedirectStandardError = true;
//设置不显示窗口
MyProcess.StartInfo.CreateNoWindow = true;
//执行强制结束命令
MyProcess.Start();
MyProcess.StandardInput.WriteLine(path+" /start QQUIN:"+user+" PWDHASH:" + EncodeHash.pwdHash(pwd) + " /stat:"+type);//直接结束进程ID
MyProcess.StandardInput.WriteLine("Exit");
}
private void btnExit_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void txtUser_KeyPress(object sender, KeyPressEventArgs e)
{
if ((e.KeyChar '0' || e.KeyChar '9')e.KeyChar!=8)
{//只能输入数字和退格键
e.Handled = true;
}
}
private void QQLoginForm_Load(object sender, EventArgs e)
{
LoadInfo();//单用户获取
}
private void LoadInfo()
{//单用户获取
ui = SerializeHelper.DeserializeUserInfo();//返回获取后对象
if (ui != null)
{
this.txtUser.Text = ui.Username;//填充文本框
this.txtPwd.Text = ui.Password;//填充密码框
this.cboType.SelectedIndex = ui.Type == "41" ? 0 : 1;//选择登陆方式
}
else
{
this.cboType.SelectedIndex = 0;
}
}
private void btnConfig_Click(object sender, EventArgs e)
{
ConfigForm cf = new ConfigForm();
cf.ShowDialog();
LoadInfo();
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace QQLogin
{
public partial class ConfigForm : Form
{
UserInfo ui;
public ConfigForm()
{
InitializeComponent();
}
private void txtPath_Click(object sender, EventArgs e)
{//点击一次文本框,弹出一次对话框来选择QQ路径
DialogResult dr = this.opfQQ.ShowDialog();
if (dr == DialogResult.OK)
{
this.txtPath.Text = opfQQ.FileName;
}
}
private bool ValidateInput()
{//验证是否输入完整
if (this.txtUser.Text == "")
{
this.txtUser.Focus();
return false;
}
else if (this.txtPwd.Text == "")
{
this.txtPwd.Focus();
return false;
}
else if (this.txtPath.Text == "")
{
return false;
}
return true;
}
private void btnCancel_Click(object sender, EventArgs e)
{
this.Close();
}
private void ConfigForm_Load(object sender, EventArgs e)
{
LoadInfo();
}
private void btnSave_Click(object sender, EventArgs e)
{
ui = new UserInfo();
ui.Username = this.txtUser.Text.Trim();
ui.Password = this.txtPwd.Text;
ui.Type = this.cboType.Text == "正常" ? "41" : "40";
ui.Path = this.txtPath.Text;
if (this.ValidateInput())
{
SerializeHelper.SerializeUserInfo(ui);
this.Close();
}
}
private void LoadInfo()
{
ui = SerializeHelper.DeserializeUserInfo();
if (ui != null)
{
this.txtUser.Text = ui.Username;
this.txtPwd.Text = ui.Password;
this.cboType.SelectedIndex = ui.Type == "41" ? 0 : 1;
this.txtPath.Text = ui.Path;
}
else
{
this.cboType.SelectedIndex = 0;
}
}
}
}