我需要设置一个用于发送短信的应用程序。已经知道sms网关类型。但我真的想与SIM集成。我需要通过SIM(通过COM端口连接到PC)发送
答案 0 :(得分:2)
在这里,您可以找到可以帮助您完成任务的免费图书馆:http://www.codeproject.com/KB/cs/SMS.aspx?msg=3179142
或者你可以选择一些做同样事情的商业图书馆:例如http://www.logixmobile.com/products/mcorelib/index.asp。
答案 1 :(得分:0)
Imports System.IO.Ports
Public Class Exampl1
Public Class Form1
Dim WithEvents serialport As New IO.Ports.SerialPort
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
For i As Integer = 0 To My.Computer.Ports.SerialPortNames.Count - 1
.Items.Add(My.Computer.Ports.SerialPortNames(i))
Next
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If serialport.IsOpen Then
serialport.Close()
End If
Try
With serialport
.PortName = ComboBox1.Text
.BaudRate = 96000
.Parity = Parity.None
.DataBits = 8
.StopBits = StopBits.One
.Handshake = Handshake.RequestToSend
.DtrEnable = True
.RtsEnable = True
.NewLine = vbCrLf
End With
serialport.Open()
Catch ex As Exception
End Try
serialport.WriteLine("AT+CMGF=1" & vbCr)
System.Threading.Thread.Sleep(200)
serialport.WriteLine("AT+CMGS=" & Chr(34) & "destination" & Chr(34) & vbCr)
System.Threading.Thread.Sleep(200)
serialport.WriteLine("test message" & vbCrLf & Chr(26))
System.Threading.Thread.Sleep(200)
End Sub
End Class
结束班