?? form1.frm
字號:
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 8595
ClientLeft = 60
ClientTop = 345
ClientWidth = 10590
LinkTopic = "Form1"
ScaleHeight = 8595
ScaleWidth = 10590
StartUpPosition = 3 '窗口缺省
Begin VB.Frame Frame3
Caption = "接收短信測試"
Height = 2535
Left = 120
TabIndex = 13
Top = 6000
Width = 10335
Begin VB.CommandButton Command4
Caption = "接收短信"
Height = 375
Left = 9000
TabIndex = 21
Top = 480
Width = 1095
End
Begin VB.TextBox jsnr
Height = 1575
Left = 1560
MultiLine = -1 'True
ScrollBars = 3 'Both
TabIndex = 20
Top = 480
Width = 7095
End
Begin VB.Label Label8
BackColor = &H80000018&
Caption = "*接收短信息返回字符串格式為:手機號碼|短信內容||手機號碼|短信內容||"
Height = 255
Index = 0
Left = 720
TabIndex = 22
Top = 2160
Width = 7935
End
Begin VB.Label Label7
Caption = "接收內容"
Height = 375
Left = 600
TabIndex = 19
Top = 480
Width = 975
End
End
Begin VB.Frame Frame2
Caption = "發送短信測試"
Height = 2415
Left = 120
TabIndex = 12
Top = 3480
Width = 10335
Begin VB.CommandButton Command3
Caption = "發送短信"
Height = 375
Left = 9000
TabIndex = 18
Top = 240
Width = 1095
End
Begin VB.TextBox fsnr
Height = 1095
Left = 1560
MultiLine = -1 'True
ScrollBars = 3 'Both
TabIndex = 17
Top = 840
Width = 7095
End
Begin VB.TextBox jshm
Height = 375
Left = 1560
TabIndex = 16
Top = 240
Width = 7095
End
Begin VB.Label Label8
BackColor = &H80000018&
Caption = "*小靈通格式:本地:106+區號+號碼;外地:106+0+區號+號碼"
Height = 255
Index = 1
Left = 600
TabIndex = 23
Top = 2040
Width = 8055
End
Begin VB.Label Label6
Caption = "發送內容"
Height = 375
Left = 600
TabIndex = 15
Top = 720
Width = 855
End
Begin VB.Label Label5
Caption = "接收號碼"
Height = 255
Left = 600
TabIndex = 14
Top = 360
Width = 855
End
End
Begin VB.Frame Frame1
Caption = "系統信息"
Height = 2775
Left = 120
TabIndex = 0
Top = 600
Width = 10335
Begin VB.CommandButton Command2
Caption = "錯誤信息"
Height = 375
Left = 360
TabIndex = 11
Top = 1800
Width = 1095
End
Begin VB.TextBox cwxx
Height = 855
Left = 1560
MultiLine = -1 'True
ScrollBars = 3 'Both
TabIndex = 10
Top = 1800
Width = 7095
End
Begin VB.TextBox sqhm
Height = 375
Left = 1560
TabIndex = 9
Text = "RIWT-DGFI-CFWW-GIWQ"
Top = 1320
Width = 4935
End
Begin VB.CommandButton Command1
Caption = "機器號碼"
Height = 375
Left = 360
TabIndex = 7
Top = 840
Width = 1095
End
Begin VB.TextBox jqhm
Height = 375
Left = 1560
TabIndex = 6
Top = 840
Width = 4935
End
Begin VB.TextBox Baud
Height = 375
Left = 4800
TabIndex = 5
Top = 360
Width = 1695
End
Begin VB.TextBox Device
Height = 375
Left = 2040
TabIndex = 3
Top = 360
Width = 1815
End
Begin VB.Label Label8
BackColor = &H80000018&
Caption = "*由廠商根據機器號碼產生出來的。"
Height = 255
Index = 4
Left = 6600
TabIndex = 26
Top = 1440
Width = 3375
End
Begin VB.Label Label8
BackColor = &H80000018&
Caption = "*請將此機器號碼發送給廠商。"
Height = 255
Index = 3
Left = 6600
TabIndex = 25
Top = 960
Width = 3375
End
Begin VB.Label Label8
BackColor = &H80000018&
Caption = "*若不指定系統會自動進行檢測。"
Height = 255
Index = 2
Left = 6600
TabIndex = 24
Top = 480
Width = 3375
End
Begin VB.Label Label4
Caption = "授權號碼"
Height = 375
Left = 600
TabIndex = 8
Top = 1440
Width = 735
End
Begin VB.Label Label3
Caption = "波特率"
Height = 255
Left = 4200
TabIndex = 4
Top = 480
Width = 615
End
Begin VB.Label Label2
Caption = "端口"
Height = 255
Left = 1560
TabIndex = 2
Top = 480
Width = 615
End
End
Begin VB.Label Label1
Alignment = 2 'Center
BackColor = &H00808000&
Caption = "短信接口VB6測試"
BeginProperty Font
Name = "隸書"
Size = 18
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H8000000E&
Height = 495
Left = 120
TabIndex = 1
Top = 0
Width = 10335
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Declare Sub GSMModemRelease Lib "dllforvc.dll" ()
Private Declare Function getTestString Lib "testVBDll.dll" () As Byte()
Private Declare Function GSMModemIsConn Lib "dllforvc.dll" () As Boolean
Private Declare Function GSMModemGetErrorMsg Lib "dllforvc.dll" () As String
Private Declare Function GSMModemGetDevice Lib "dllforvc.dll" () As String
Private Declare Function GSMModemGetBaudrate Lib "dllforvc.dll" () As String
Private Declare Function GSMModemGetSnInfoNew Lib "dllforvc.dll" (ByVal Device As String, ByVal baudrate As String) As String
Private Declare Function GSMModemInitNew Lib "dllforvc.dll" (ByVal Device As String, ByVal baudrate As String, ByVal initstring As String, ByVal charset As String, ByVal swHandshake As Boolean, ByVal sn As String) As Boolean
Private Declare Function GSMModemSMSsend Lib "dllforvc.dll" (ByVal serviceCenterAddress As String, ByVal encodeval As Integer, ByVal text As String, ByVal textlen As Integer, ByVal phonenumber As String, ByVal requestStatusReport As Boolean) As Boolean
Private Declare Function GSMModemSMSReadAll Lib "dllforvc.dll" (ByVal RD_opt As Integer) As String
Private Sub Command1_Click()
jqhm.text = GSMModemGetSnInfoNew(Device.text, Baud.text)
Device.text = GSMModemGetDevice()
Baud.text = GSMModemGetBaudrate()
cwxx.text = GSMModemGetErrorMsg()
End Sub
Private Sub Command3_Click()
Dim smscontent As String
Dim number As String
Dim smslen As Long
Dim charset As String
Dim ret As Boolean
'0) 格式檢查
If jshm.text = "" Then
MsgBox "手機號碼不能為空!"
jshm.SetFocus
Exit Sub
End If
smslen = Len(jshm.text)
'If smslen <> 11 Then
' MsgBox "手機號碼長度不對!"
' jshm.SetFocus
' Exit Sub
'End If
If fsnr.text = "" Then
MsgBox "短信內容不能為空!"
fsnr.SetFocus
Exit Sub
End If
'1)連接設備
ret = GSMModemInitNew(Device.text, Baud.text, "", "GSM", False, sqhm.text)
If ret Then
MsgBox "GSMModemInit: 連接成功!"
Else
MsgBox "GSMModemInit: 連接失敗!" + GSMModemGetErrorMsg()
Exit Sub
End If
cwxx.text = GSMModemGetErrorMsg()
Device.text = GSMModemGetDevice()
Baud.text = GSMModemGetBaudrate()
'2) 發送短信
smscontent = fsnr.text
'smslen = Len(fsnr.text)
smslen = LenB(StrConv(fsnr.text, vbFormUnicode))
number = jshm.text
ret = GSMModemSMSsend("", 8, fsnr.text, smslen, jshm.text, False)
If ret Then
MsgBox "GSMModemSMSsend: 短信發送成功!"
Else
MsgBox "GSMModemSMSsend: 短信發送失敗!" + GSMModemGetErrorMsg()
End If
cwxx.text = GSMModemGetErrorMsg()
'3) 顯示錯誤信息
cwxx.text = GSMModemGetErrorMsg()
'4) 釋放資源
GSMModemRelease
End Sub
Private Sub Command4_Click()
Dim ret As Boolean
ret = GSMModemInitNew(Device.text, Baud.text, "", "GSM", False, sqhm.text)
'1)連接設備
If ret Then
MsgBox ("GSMModemInit: 連接成功!")
Else
MsgBox ("GSMModemInit: 連接失敗!" + GSMModemGetErrorMsg())
Exit Sub
End If
cwxx.text = GSMModemGetErrorMsg()
Device.text = GSMModemGetDevice()
Baud.text = GSMModemGetBaudrate()
'2)接收短信
jsnr.text = GSMModemSMSReadAll(0)
cwxx.text = GSMModemGetErrorMsg()
If jsnr.text = "" Then
jsnr.text = "無短信息!"
End If
'4) 釋放資源
GSMModemRelease
cwxx.text = GSMModemGetErrorMsg()
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -