从手机发送短信到PC上的vb.net应用程序 [英] send sms from mobile to vb.net application on PC

查看:77
本文介绍了从手机发送短信到PC上的vb.net应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图编写代码,以便通过USB调制解调器通过收件箱发送SMS到达vb.net应用程序时,在这种情况下,我有问题是如何使用vb.net编译AT命令,例如读取和显示在文本框上vb.net应用程序.

我对以下带下划线的编码有疑问.因此该编码方面的任何专家都请帮助我.

谢谢

i tried to write coding for when send SMS to get to vb.net application through inbox in USB modem, in this case i have problem is how to AT commands compile with vb.net for example reading and showing on text box on vb.net application.

i have problem with below underlined coding. so anyone experts in this coding please help me.

thank you

Imports System
Imports System.Threading
Imports System.ComponentModel
Imports System.IO.Ports
Public Class Form1
    Private WithEvents SMSPort As SerialPort
    Private SMSThread As Thread
    Private ReadThread As Thread
    Shared _Continue As Boolean = False
    Shared _ContSMS As Boolean = False
    Private _Wait As Boolean = False
    Shared _ReadPort As Boolean = False
    Public Event Sending(ByVal Done As Boolean)
    Public Event DataReceived(ByVal Message As String)
    Public Sub WindowsApplicaton2(ByRef COMMPORT As String)
        SMSPort = New SerialPort
        With SMSPort
            .PortName = COMMPORT
            .BaudRate = 19200
            .Parity = Parity.None
            .DataBits = 8
            .StopBits = StopBits.One
            .Handshake = Handshake.RequestToSend
            .DtrEnable = True
            .RtsEnable = True
            .NewLine = vbCrLf
        End With
    End Sub
    Public Function ReceiveSMS(ByVal textbox1 As TextBox) As Boolean
        SMSPort.WriteLine("AT")
        SMSPort.WriteLine("AT+CMGF=1" & vbCrLf)
        SMSPort.WriteLine("AT+ CNMI=1,1,0,0,0" & vbCrLf)
        SMSPort.WriteLine("AT+CMGR= 10" & vbCrLf)
        textbox1.Text = SMSPort.ReadExisting
        SMSPort.WriteLine("AT+CMGD=")
    End Function
End Class

推荐答案

您实际上在哪里打开了串行端口连接?

看到您正在使用VB.net时,您是否看过My.Computer.Ports.OpenSerialPort

http://msdn.microsoft.com/en-us/library /tf5cds00(v=vs.80).aspx#Y1529 [ http://msdn.microsoft.com/en-us/library/system. io.ports.serialport.aspx [ ^ ]
Where have you actually OPENED the serial port connection?

Seeing as you are using VB.net, have you looked at My.Computer.Ports.OpenSerialPort

http://msdn.microsoft.com/en-us/library/tf5cds00(v=vs.80).aspx#Y1529[^]

And the serial port class documentation; http://msdn.microsoft.com/en-us/library/system.io.ports.serialport.aspx[^]


这篇关于从手机发送短信到PC上的vb.net应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆