?? vbsample.frm
字號(hào):
Top = 5520
Width = 1095
End
Begin VB.Line Line13
X1 = 480
X2 = 7200
Y1 = 2880
Y2 = 2880
End
Begin VB.Label Label13
Caption = "注冊(cè)號(hào):"
Height = 375
Left = 8760
TabIndex = 27
Top = 5040
Width = 735
End
Begin VB.Label Label12
Caption = "IMEI號(hào):"
Height = 375
Left = 8760
TabIndex = 25
Top = 4440
Width = 735
End
Begin VB.Line Line1
X1 = 8280
X2 = 12600
Y1 = 3600
Y2 = 3600
End
Begin VB.Line Line12
X1 = 8280
X2 = 12600
Y1 = 960
Y2 = 960
End
Begin VB.Label Label11
Caption = "SIM 位置號(hào)(1~25)"
Height = 375
Left = 8520
TabIndex = 20
Top = 1440
Width = 1095
End
Begin VB.Line Line11
X1 = 12600
X2 = 12600
Y1 = 360
Y2 = 8400
End
Begin VB.Line Line10
X1 = 8280
X2 = 12600
Y1 = 8400
Y2 = 8400
End
Begin VB.Line Line9
X1 = 8280
X2 = 8280
Y1 = 360
Y2 = 8400
End
Begin VB.Line Line8
X1 = 8280
X2 = 12600
Y1 = 360
Y2 = 360
End
Begin VB.Line Line7
X1 = 7200
X2 = 7200
Y1 = 2760
Y2 = 360
End
Begin VB.Line Line6
X1 = 480
X2 = 7200
Y1 = 360
Y2 = 360
End
Begin VB.Line Line5
X1 = 480
X2 = 7200
Y1 = 8400
Y2 = 8400
End
Begin VB.Line Line4
X1 = 480
X2 = 480
Y1 = 360
Y2 = 8400
End
Begin VB.Label Label10
Caption = "輔助函數(shù)使用"
Height = 375
Left = 9360
TabIndex = 19
Top = 600
Width = 1335
End
Begin VB.Line Line3
X1 = 7200
X2 = 7200
Y1 = 2760
Y2 = 8400
End
Begin VB.Label Label9
Caption = "時(shí)間:"
Height = 255
Left = 960
TabIndex = 16
Top = 7680
Width = 975
End
Begin VB.Label Label8
Caption = "接收信息:"
Height = 375
Left = 960
TabIndex = 14
Top = 6720
Width = 1095
End
Begin VB.Label Label7
Caption = "發(fā)送人:"
Height = 375
Left = 960
TabIndex = 12
Top = 6240
Width = 975
End
Begin VB.Label Label6
Caption = "事件ID:"
Height = 255
Left = 4800
TabIndex = 10
Top = 6240
Width = 855
End
Begin VB.Line Line2
X1 = 480
X2 = 7200
Y1 = 5280
Y2 = 5280
End
Begin VB.Label Label5
Caption = "發(fā)送信息:"
Height = 375
Left = 960
TabIndex = 7
Top = 4080
Width = 975
End
Begin VB.Label Label4
Caption = "手機(jī)號(hào)碼:"
Height = 375
Left = 960
TabIndex = 5
Top = 3360
Width = 1095
End
Begin VB.Label Label3
Caption = "通信設(shè)備類型:"
Height = 375
Left = 960
TabIndex = 4
Top = 2160
Width = 1215
End
Begin VB.Label Label2
Caption = "數(shù)據(jù)傳輸速率:"
Height = 375
Left = 960
TabIndex = 2
Top = 1320
Width = 1215
End
Begin VB.Label Label1
Caption = "通迅端口號(hào):"
Height = 255
Left = 960
TabIndex = 0
Top = 720
Width = 1095
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click() '初始化
Dim n As Integer
n = Smscom1.InitDevice(Port.Text, Baud, szType.Text)
If n = 0 Then
MsgBox ("初始化成功.")
n = Smscom1.SetStateReport(1, 0) '*<------ 設(shè)置發(fā)送狀態(tài)報(bào)告 nRequest nDevice(保留,為0)
Else: MsgBox ("初始化失敗.") ' 不需要 0 0
End If ' 需要 1 0
End Sub
Private Sub Command2_Click() '發(fā)送短信
Dim n As Integer
n = Smscom1.SendMsg(Phone, outMessage)
If (n <> 0) Then MsgBox ("請(qǐng)初始化設(shè)備.")
End Sub
Private Sub Command3_Click() '關(guān)閉設(shè)備
Dim n As Integer
n = Smscom1.CloseDevice() '退出時(shí)必須調(diào)用!!,釋放資源
MsgBox ("已關(guān)閉設(shè)備.")
End Sub
Private Sub Smscom1_SmsEvent(ByVal nID As Integer, ByVal szPhone As String, ByVal szText As String, ByVal szTime As String)
ID = nID 'nID = 1 發(fā)送成功
' = 2 發(fā)送失敗
' = 3 接收短信
' = 4 狀態(tài)報(bào)告 <--------------- New
' = 6 電池電量(0-100)
' = 7 信號(hào)強(qiáng)度(0-31)
Sender = szPhone ' 發(fā)送者
inMessage = szText ' 消息, 信號(hào)強(qiáng)度, 電池電量
DateTime = szTime ' 時(shí)間
End Sub
Private Sub Command4_Click() '主動(dòng)刪除短信,控件自動(dòng)刪除收到的短信,也可用其函數(shù)主動(dòng)刪除.
Dim n As Integer
n = Smscom1.SendCmd("AT+CMGD = " + Loc) '主動(dòng)刪除sim中Loc位置的短信, 參數(shù)Loc的范圍 1 - 25 .
End Sub
Private Sub Command5_Click() '發(fā)送AT命令
Dim n As Integer
n = Smscom1.SendCmd("ATDT1860;") '撥號(hào)1860
End Sub
Private Sub Command6_Click() '注冊(cè)函數(shù)在安裝控件后,調(diào)用一次即可.
Dim n As Integer
n = Smscom1.RegSoftware(IMEI, SerialNo) ' IMEI 為手機(jī)設(shè)備號(hào), 在手機(jī)上按 *#06# 顯示 或 使用 AT+CGSN 指令讀出
If n = 0 Then ' SerialNo 為注冊(cè)號(hào)
MsgBox ("注冊(cè)成功.")
Else: MsgBox ("注冊(cè)失敗.")
End If
End Sub
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -