Sending a SMS Message in PDU Mode:AT+CPIN="nnnn" Enter PIN which enables SIM card. Sending a SMS Message in PDU Mode AT+CPIN=”nnnn” Enter PIN which enables SIM card. AT+CSMS=0 Select message service response; response will be +CSMS:001,001,001 AT+CPMS=”SM” Select preferred message storage; response will be similar to +CPMS:001,0015,001,015 depending on your SIM card. AT+CMGS=<length of TPDU><cr> <SCA><TPDU><ctrl-Z> <SCA>: Service Center Address, refer to GSM 04.11 <TPDU>: Transport Protocol Data Unit, refer to GSM 03.40Receiving a SMS message:AT+CSMS=0 Select message service AT+CPMS="SM" Select preferred message storage AT+CNMI=2,1 Allow unsolicited incoming messages when message received +CMTI: "SM",001 will be displayed (001 message location) To display incoming messages: AT+CMGL=4 Lists all stored messages AT+CMGR=1 Reads message at location 001 +CMGR: 000,,102 038021430402802100006990502100000064D22792580 49940D321F21A946A4153F45B4E0735CBF379F85C0 64DCB727B7A5C0651CB73BA0B44459741D17A7AB C0609E5EFBB1B647CE341CA7A1B3E073DED65398 88A2E8398617D1E447C9F5DA0986C46ABD96EB81C 4C01 OK
谁有可以运行的手机短信sample code,放在 http://howto-solutions.com卖, 我出10 US dollar来买.
看看这段,发了一点点 Private Sub about_Click() frmAbout.Show End SubPrivate Sub Command1_Click() For i = 0 To prefixe.ListCount - 1 Step 1 If prefixe.Selected(i) = True Then envoyer.Close message.Text = Replace(message.Text, " ", "+", 1, , vbBinaryCompare) Reseaux = Replace(Reseaux, "NUMERO", numero.Text, 1, , vbBinaryCompare) Reseaux = Replace(Reseaux, "TAILLE", carac.Caption, 1, , vbBinaryCompare) Reseaux = Replace(Reseaux, "PREFIXE", "32" & Mid(prefixe.List(prefixe.ListIndex), 2), 1, , vbBinaryCompare) Reseaux = Replace(Reseaux, "MESSAGE", message.Text, 1, , vbBinaryCompare) message.Text = Replace(message.Text, "+", "%20", 1, , vbBinaryCompare) Reseaux2 = Replace(Reseaux2, "NUMERO", numero.Text, 1, , vbBinaryCompare) Reseaux2 = Replace(Reseaux2, "TAILLE", carac.Caption, 1, , vbBinaryCompare) Reseaux2 = Replace(Reseaux2, "PREFIXE", "32" & Mid(prefixe.List(prefixe.ListIndex), 2), 1, , vbBinaryCompare) Reseaux2 = Replace(Reseaux2, "MESSAGE", message.Text, 1, , vbBinaryCompare) If Existe_Proxy Then envoyer.Connect Adresse_Proxy, Port_ecoute_proxy Else envoyer.Connect "212.68.202.150", 80 End If message.Text = Replace(message.Text, "+", " ", 1, , vbBinaryCompare) Exit Sub End If Next MsgBox "Choisir le préfixe!" End SubPrivate Sub Command2_Click() Unload Me isconnected provi.hangup End SubPrivate Sub directe_Click() provi.Show End SubPrivate Sub envoyer_Connect() envoyer.SendData Reseaux envoyer.SendData Reseaux2 End SubPrivate Sub envoyer_DataArrival(ByVal bytesTotal As Long) envoyer.GetData donnee MsgBox "Mini Message Envoyé !" envoyer.Close Form_Load End Sub Private Sub Form_Load() Dim numfile As Integer Dim donnee As String Dim k, l As Integer numfile = FreeFile fic = FreeFile Open App.Path & "\provider.txt" For Binary As numfile donnee = String(LOF(numfile), " ") Get numfile, , donnee Close numfile If donnee <> "" Then pos = InStr(1, donnee, vbCrLf, vbBinaryCompare) PROVIDER = Left(donnee, pos - 1) donnee = Mid(donnee, pos + 2) pos = InStr(1, donnee, vbCrLf, vbBinaryCompare) LOGIN = Left(donnee, pos - 1) donnee = Mid(donnee, pos + 2) pos = InStr(1, donnee, vbCrLf, vbBinaryCompare) PASSWORD = Left(donnee, pos - 1) donnee = Mid(donnee, pos + 2) pos = InStr(1, donnee, vbCrLf, vbBinaryCompare) DOMAINE = Left(donnee, pos - 1) End If Open App.Path & "\reseaux.txt" For Binary As numfile Reseaux = String(LOF(numfile), " ") Get numfile, , Reseaux Close numfile Open App.Path & "\reseaux2.txt" For Binary As numfile Reseaux2 = String(LOF(numfile), " ") Get numfile, , Reseaux2 Close numfile Open App.Path & "\proxy.txt" For Binary As numfile donnee = String(LOF(numfile), " ") Get numfile, , donnee Close numfile If donnee <> "" Then If Mid(donnee, 1, 1) = 1 Then Existe_Proxy = True Adresse_Proxy = Mid(donnee, 2, 15) Port_ecoute_proxy = Mid(donnee, 17) Else Existe_Proxy = False End If End If End Sub Private Sub Form_Paint() 'FAIT UN DEGRADE A L'ECRAN l = 1 For k = Me.ScaleHeight To 1 Step -1 Me.Line (1, l)-(Me.ScaleWidth, l), RGB(0, 0, k * 256 / Me.ScaleHeight) l = l + 1 NextEnd SubPrivate Sub message_Change() carac.Caption = 140 - Len(message.Text)End SubPrivate Sub message_KeyPress(KeyAscii As Integer) If KeyAscii <> 8 Then carac.Caption = Int(carac.Caption) - 1 Else If message.Text <> "" Then carac.Caption = Int(carac.Caption) + 1 End If End If If carac.Caption = -1 Then message.Text = Mid(message.Text, 1, Len(message.Text) - 1) message.SelStart = Len(message.Text) carac.Caption = 0 End If End SubPrivate Sub Option1_Click(Index As Integer) prefixe.Clear prefixe.Enabled = True numero.Enabled = True message.Enabled = True If Option1(0).Value = True Then carac.Caption = "140" prefixe.AddItem "0495", 0 prefixe.AddItem "0496", 1 prefixe.AddItem "0497", 2 prefixe.ForeColor = &HFF00& numero.ForeColor = &HFF00& End If If Option1(1).Value = True Then carac.Caption = " 140" prefixe.AddItem "0486", 0 prefixe.ForeColor = &H80FF& numero.ForeColor = &H80FF& End If If Option1(2).Value = True Then carac.Caption = "140" prefixe.AddItem "075", 0 prefixe.AddItem "0476", 1 prefixe.AddItem "0477", 2 prefixe.AddItem "0478", 3 prefixe.AddItem "0479", 4 prefixe.ForeColor = &HFFFF00 numero.ForeColor = &HFFFF00 End If carac.Caption = Int(carac.Caption) - Len(message.Text) End Sub Private Sub prefixe_Click() 'prefixe.Selected(prefixe.ListIndex) = True End SubPrivate Sub prefixe_Scroll() prefixe_Click End SubPrivate Sub viaproxy_Click() Proxyoption.Show End Sub
Sending a SMS Message in PDU Mode
AT+CPIN=”nnnn” Enter PIN which enables SIM card.
AT+CSMS=0 Select message service response; response will be
+CSMS:001,001,001
AT+CPMS=”SM” Select preferred message storage; response will be
similar to +CPMS:001,0015,001,015 depending on
your SIM card.
AT+CMGS=<length of TPDU><cr>
<SCA><TPDU><ctrl-Z> <SCA>: Service Center Address, refer to GSM 04.11
<TPDU>: Transport Protocol Data Unit, refer to GSM
03.40Receiving a SMS message:AT+CSMS=0 Select message service
AT+CPMS="SM" Select preferred message storage
AT+CNMI=2,1 Allow unsolicited incoming messages when message
received
+CMTI: "SM",001 will be displayed (001 message location)
To display incoming messages:
AT+CMGL=4 Lists all stored messages
AT+CMGR=1 Reads message at location 001
+CMGR: 000,,102
038021430402802100006990502100000064D22792580
49940D321F21A946A4153F45B4E0735CBF379F85C0
64DCB727B7A5C0651CB73BA0B44459741D17A7AB
C0609E5EFBB1B647CE341CA7A1B3E073DED65398
88A2E8398617D1E447C9F5DA0986C46ABD96EB81C
4C01
OK
我出10 US dollar来买.
Private Sub about_Click()
frmAbout.Show
End SubPrivate Sub Command1_Click()
For i = 0 To prefixe.ListCount - 1 Step 1
If prefixe.Selected(i) = True Then
envoyer.Close
message.Text = Replace(message.Text, " ", "+", 1, , vbBinaryCompare) Reseaux = Replace(Reseaux, "NUMERO", numero.Text, 1, , vbBinaryCompare)
Reseaux = Replace(Reseaux, "TAILLE", carac.Caption, 1, , vbBinaryCompare)
Reseaux = Replace(Reseaux, "PREFIXE", "32" & Mid(prefixe.List(prefixe.ListIndex), 2), 1, , vbBinaryCompare)
Reseaux = Replace(Reseaux, "MESSAGE", message.Text, 1, , vbBinaryCompare) message.Text = Replace(message.Text, "+", "%20", 1, , vbBinaryCompare)
Reseaux2 = Replace(Reseaux2, "NUMERO", numero.Text, 1, , vbBinaryCompare)
Reseaux2 = Replace(Reseaux2, "TAILLE", carac.Caption, 1, , vbBinaryCompare)
Reseaux2 = Replace(Reseaux2, "PREFIXE", "32" & Mid(prefixe.List(prefixe.ListIndex), 2), 1, , vbBinaryCompare)
Reseaux2 = Replace(Reseaux2, "MESSAGE", message.Text, 1, , vbBinaryCompare)
If Existe_Proxy Then
envoyer.Connect Adresse_Proxy, Port_ecoute_proxy
Else
envoyer.Connect "212.68.202.150", 80
End If
message.Text = Replace(message.Text, "+", " ", 1, , vbBinaryCompare)
Exit Sub
End If
Next
MsgBox "Choisir le préfixe!"
End SubPrivate Sub Command2_Click()
Unload Me
isconnected
provi.hangup
End SubPrivate Sub directe_Click()
provi.Show
End SubPrivate Sub envoyer_Connect()
envoyer.SendData Reseaux
envoyer.SendData Reseaux2
End SubPrivate Sub envoyer_DataArrival(ByVal bytesTotal As Long)
envoyer.GetData donnee
MsgBox "Mini Message Envoyé !"
envoyer.Close
Form_Load
End Sub
Private Sub Form_Load()
Dim numfile As Integer
Dim donnee As String
Dim k, l As Integer
numfile = FreeFile fic = FreeFile
Open App.Path & "\provider.txt" For Binary As numfile
donnee = String(LOF(numfile), " ")
Get numfile, , donnee
Close numfile
If donnee <> "" Then
pos = InStr(1, donnee, vbCrLf, vbBinaryCompare)
PROVIDER = Left(donnee, pos - 1)
donnee = Mid(donnee, pos + 2)
pos = InStr(1, donnee, vbCrLf, vbBinaryCompare)
LOGIN = Left(donnee, pos - 1)
donnee = Mid(donnee, pos + 2)
pos = InStr(1, donnee, vbCrLf, vbBinaryCompare)
PASSWORD = Left(donnee, pos - 1)
donnee = Mid(donnee, pos + 2)
pos = InStr(1, donnee, vbCrLf, vbBinaryCompare)
DOMAINE = Left(donnee, pos - 1)
End If Open App.Path & "\reseaux.txt" For Binary As numfile
Reseaux = String(LOF(numfile), " ")
Get numfile, , Reseaux
Close numfile Open App.Path & "\reseaux2.txt" For Binary As numfile
Reseaux2 = String(LOF(numfile), " ")
Get numfile, , Reseaux2
Close numfile Open App.Path & "\proxy.txt" For Binary As numfile
donnee = String(LOF(numfile), " ")
Get numfile, , donnee
Close numfile
If donnee <> "" Then
If Mid(donnee, 1, 1) = 1 Then
Existe_Proxy = True
Adresse_Proxy = Mid(donnee, 2, 15)
Port_ecoute_proxy = Mid(donnee, 17)
Else
Existe_Proxy = False
End If
End If
End Sub
Private Sub Form_Paint() 'FAIT UN DEGRADE A L'ECRAN
l = 1
For k = Me.ScaleHeight To 1 Step -1
Me.Line (1, l)-(Me.ScaleWidth, l), RGB(0, 0, k * 256 / Me.ScaleHeight)
l = l + 1
NextEnd SubPrivate Sub message_Change() carac.Caption = 140 - Len(message.Text)End SubPrivate Sub message_KeyPress(KeyAscii As Integer)
If KeyAscii <> 8 Then
carac.Caption = Int(carac.Caption) - 1
Else
If message.Text <> "" Then
carac.Caption = Int(carac.Caption) + 1
End If
End If
If carac.Caption = -1 Then
message.Text = Mid(message.Text, 1, Len(message.Text) - 1)
message.SelStart = Len(message.Text)
carac.Caption = 0
End If
End SubPrivate Sub Option1_Click(Index As Integer)
prefixe.Clear
prefixe.Enabled = True
numero.Enabled = True
message.Enabled = True If Option1(0).Value = True Then
carac.Caption = "140"
prefixe.AddItem "0495", 0
prefixe.AddItem "0496", 1
prefixe.AddItem "0497", 2
prefixe.ForeColor = &HFF00&
numero.ForeColor = &HFF00&
End If If Option1(1).Value = True Then
carac.Caption = " 140"
prefixe.AddItem "0486", 0
prefixe.ForeColor = &H80FF&
numero.ForeColor = &H80FF&
End If If Option1(2).Value = True Then
carac.Caption = "140"
prefixe.AddItem "075", 0
prefixe.AddItem "0476", 1
prefixe.AddItem "0477", 2
prefixe.AddItem "0478", 3
prefixe.AddItem "0479", 4
prefixe.ForeColor = &HFFFF00
numero.ForeColor = &HFFFF00
End If carac.Caption = Int(carac.Caption) - Len(message.Text)
End Sub
Private Sub prefixe_Click()
'prefixe.Selected(prefixe.ListIndex) = True
End SubPrivate Sub prefixe_Scroll()
prefixe_Click
End SubPrivate Sub viaproxy_Click()
Proxyoption.Show
End Sub
http://0926.net/archive/sms.htm
at指令的下载地址 http://www.cetinet.com/download/list.asp?id=179上面的链接虽然实现的方式不一样,
但参考参考还是可以的,
希望对楼主有用。
to:charise(黑码)
你知广州哪里有卖GSM MODEM吗?