vb.net如何发短信 vba发送微信消息完整代码

有谁搞过vb.net或c#给QQ好友发信息的?怎样实现的,能不能说说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();//如果没有提取出来对象vb.net如何发短信,就创建一个
}
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路径vb.net如何发短信,如果没有就打开对话框来选择一下
DialogResult dr = this.opfQQ.ShowDialog();
if (dr == DialogResult.OK)
{
ui.Path = opfQQ.FileName;//将选择vb.net如何发短信的路径赋值给对象
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的命令vb.net如何发短信,通过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;

推荐阅读