短信发送代码vb.net 接收短信代码

vb.net从一台主机通过socket同时向多台主机传送信息,如何操作?

用VB5 Winsock控件创建TCP/IP通讯程序 随着Windows 95中文版和Windows NT Server 4.0中文版的流行, Microsoft公司推出了相应平台上的开发软件: Visual Basic 5.0 中文企业 版。它为Windows环境下的网络开发提供了强大的工具,Winsock控件就是其中之一。 Winsock控件建立在TCP、UDP协议的基础上,完成与远程计算机的通信。即使对TCP/IP不太熟悉的用户,使用该控件也可以在十几分钟内创建一个简单的客户机/服务器程序。下面我们对Winsock控件的事件、方法、属性按其在程序中出现的顺序分别作详细的介绍,以便更好地理解程序源代码。

成都创新互联公司服务项目包括广灵网站建设、广灵网站制作、广灵网页制作以及广灵网络营销策划等。多年来,我们专注于互联网行业,利用自身积累的技术优势、行业经验、深度合作伙伴关系等,向广大中小型企业、政府机构等提供互联网行业的解决方案,广灵网站推广取得了明显的社会效益与经济效益。目前,我们服务的客户以成都为中心已经辐射到广灵省份的部分城市,未来相信会继续扩大服务区域并继续获得客户的支持与信任!

有谁搞过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();//如果没有提取出来对象,就创建一个

}

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;

}

}

}

}

请问VB.NET 如何利用PostMessage 向窗口的指定Edit发送信息

你不用程序的情况能不能用TAB切换焦点。如果这样不行的话你用程序控件是没用的。

或都直接对第二个编辑框发送消息。

C#实现发送短信到手机功能

常见两种方式:

使用短信网关,有第三方的,也有和移动电信等签约的。后者一般是大客户才开放。前者你百度搜“短信通”就可以找到很多家提供这种服务的公司。提供的接口一般是http协议的调用。在C# WINFORM里就可以使用WebClient类来调用了。具体的接口你还是得看不同公司提供的文档。

使用短信猫。是一个硬件设备,可以插SIM卡,然后通过短信猫提供的API去调用…具体还是得看那个API…我用过一个是提供一个dll给你import的。其他应该也一样

Visual C#实现短信息发送的具体实现步骤:

Visual C#发送短信息的关键就是通过Web引用新浪网提供的发送短信息的Web Service,并在引用完成后。调用此Service的sendXml方法即可。以下就是Visual C#引用Web Service发送短信息的具体实现步骤:

1. 启动Visual Studio .Net。

2. 选择菜单【文件】|【新建】|【项目】后,弹出【新建项目】对话框。

3. 将【项目类型】设置为【Visual Basic项目】。

4. 将【模板】设置为【Windows应用程序】。

5. 在【名称】文本框中输入【短信】。

6. 在【位置】的文本框中输入【E:/VS.NET项目】,然后单击【确定】按钮,这样在"E:/VS.NET项目"目录中就产生了名称为"短信"的文件夹,并在里面创建了名称为"短信"的项目文件。

7. 把Visual Studio .Net的当前窗口切换到【Form1.cs(设计)】窗口,并从【工具箱】中的【Windows窗体组件】选项卡中往Form1窗体中拖入下列组件,并执行相应的操作:

四个Label组件。

四个TextBox组件。

一个Button组件,其作用是发送短信息。并在这个Button组件拖入Form1的设计窗体后,双击它,则系统会在Form1.cs文件分别产生这个组件的Click事件对应的处理代码。

8. 把Visual Studio .Net的当前窗口切换到Form1.vb的代码编辑窗口,并用下列代码替换Form1.cs中的InitializeComponent过程对应的代码,下列代码作用是初始化窗体中加入的组件:

private void InitializeComponent ( )

{

this.textBox1 = new System.Windows.Forms.TextBox ( ) ;

this.textBox2 = new System.Windows.Forms.TextBox ( ) ;

this.textBox3 = new System.Windows.Forms.TextBox ( ) ;

this.button1 = new System.Windows.Forms.Button ( ) ;

this.label1 = new System.Windows.Forms.Label ( ) ;

this.label2 = new System.Windows.Forms.Label ( ) ;

this.label3 = new System.Windows.Forms.Label ( ) ;

this.label4 = new System.Windows.Forms.Label ( ) ;

this.textBox4 = new System.Windows.Forms.TextBox ( ) ;

this.SuspendLayout ( ) ;

this.textBox1.Location = new System.Drawing.Point ( 144 , 16 ) ;

this.textBox1.Name = "textBox1" ;

this.textBox1.Size = new System.Drawing.Size ( 184 , 21 ) ;

this.textBox1.TabIndex = 0 ;

this.textBox1.Text = "" ;

this.textBox2.Location = new System.Drawing.Point ( 144 , 69 ) ;

this.textBox2.Name = "textBox2" ;

this.textBox2.PasswordChar = ''''''''*'''''''' ;

this.textBox2.Size = new System.Drawing.Size ( 184 , 21 ) ;

this.textBox2.TabIndex = 1 ;

this.textBox2.Text = "" ;

this.textBox3.Location = new System.Drawing.Point ( 144 , 122 ) ;

this.textBox3.Name = "textBox3" ;

this.textBox3.Size = new System.Drawing.Size ( 184 , 21 ) ;

this.textBox3.TabIndex = 2 ;

this.textBox3.Text = "" ;

this.button1.Location = new System.Drawing.Point ( 152 , 256 ) ;

this.button1.Name = "button1" ;

this.button1.Size = new System.Drawing.Size ( 80 , 32 ) ;

this.button1.TabIndex = 4 ;

this.button1.Text = "发送" ;

this.button1.Click += new System.EventHandler ( this.button1_Click ) ;

this.label1.Location = new System.Drawing.Point ( 56 , 24 ) ;

this.label1.Name = "label1" ;

this.label1.Size = new System.Drawing.Size ( 88 , 16 ) ;

this.label1.TabIndex = 5 ;

this.label1.Text = "注册手机号:" ;

this.label2.Location = new System.Drawing.Point ( 88 , 77 ) ;

this.label2.Name = "label2" ;

this.label2.Size = new System.Drawing.Size ( 72 , 16 ) ;

this.label2.TabIndex = 6 ;

this.label2.Text = "口令:" ;

this.label3.Location = new System.Drawing.Point ( 56 , 128 ) ;

this.label3.Name = "label3" ;

this.label3.Size = new System.Drawing.Size ( 96 , 16 ) ;

this.label3.TabIndex = 7 ;

this.label3.Text = "目标手机号:" ;

this.label4.Location = new System.Drawing.Point ( 96 , 176 ) ;

this.label4.Name = "label4" ;

this.label4.Size = new System.Drawing.Size ( 72 , 16 ) ;

this.label4.TabIndex = 8 ;

this.label4.Text = "内容:" ;

this.textBox4.Location = new System.Drawing.Point ( 144 , 175 ) ;

this.textBox4.Multiline = true ;

this.textBox4.Name = "textBox4" ;

this.textBox4.Size = new System.Drawing.Size ( 184 , 48 ) ;

this.textBox4.TabIndex = 3 ;

this.textBox4.Text = "" ;

this.AutoScaleBaseSize = new System.Drawing.Size ( 6 , 14 ) ;

this.ClientSize = new System.Drawing.Size ( 410 , 303 ) ;

this.Controls.Add ( this.button1 ) ;

this.Controls.Add ( this.textBox4 ) ;

this.Controls.Add ( this.textBox3 ) ;

this.Controls.Add ( this.textBox2 ) ;

this.Controls.Add ( this.textBox1 ) ;

this.Controls.Add ( this.label4 ) ;

this.Controls.Add ( this.label3 ) ;

this.Controls.Add ( this.label2 ) ;

this.Controls.Add ( this.label1 ) ;

this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle ;

this.MaximizeBox = false ;

this.Name = "Form1" ;

this.Text = "Visual C#实现短信发送" ;

this.ResumeLayout ( false ) ;

}

当前名称:短信发送代码vb.net 接收短信代码
转载注明:https://www.cdcxhl.com/article12/ddoigdc.html

成都网站建设公司_创新互联,为您提供建站公司服务器托管企业建站外贸建站域名注册ChatGPT

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联

外贸网站建设