📄 form1.frm
字号:
VERSION 5.00
Object = "{45D7298F-6A66-4A93-A10C-346561A46F22}#1.0#0"; "NoahMms.ocx"
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "Comdlg32.ocx"
Begin VB.Form Form1
Caption = "诺亚彩信控件调用例程"
ClientHeight = 4515
ClientLeft = 60
ClientTop = 450
ClientWidth = 7335
LinkTopic = "Form1"
ScaleHeight = 4515
ScaleWidth = 7335
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton Command_SendSms
Caption = "发送短信"
Height = 375
Left = 720
TabIndex = 6
Top = 3600
Width = 1335
End
Begin VB.TextBox Text_Sms
Height = 2055
Left = 480
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 5
Top = 1440
Width = 2055
End
Begin VB.TextBox Text_SmsRecvr
Height = 375
Left = 480
TabIndex = 4
Top = 600
Width = 2055
End
Begin VB.CommandButton Command1
Caption = "退出"
Height = 375
Left = 5880
TabIndex = 2
Top = 3600
Width = 1215
End
Begin FOXMMSLib.FoxMms FoxMms1
Height = 135
Left = 5520
TabIndex = 0
Top = 120
Visible = 0 'False
Width = 255
_Version = 65536
_ExtentX = 450
_ExtentY = 238
_StockProps = 169
End
Begin VB.Frame Frame1
Caption = "短信测试"
Height = 4095
Left = 240
TabIndex = 7
Top = 0
Width = 2535
Begin VB.Label Label2
Caption = "短信内容:"
Height = 255
Left = 240
TabIndex = 9
Top = 1200
Width = 1215
End
Begin VB.Label Label1
Caption = "接收号码:"
Height = 255
Left = 240
TabIndex = 8
Top = 360
Width = 1095
End
End
Begin VB.Frame Frame2
Caption = "彩信测试"
Height = 4095
Left = 2880
TabIndex = 10
Top = 0
Width = 4335
Begin MSComDlg.CommonDialog CommonDialog1
Left = 3720
Top = 3000
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin VB.CommandButton Command2
Caption = "发送彩信"
Height = 375
Left = 960
TabIndex = 18
Top = 3600
Width = 1455
End
Begin VB.CommandButton Command_Browse
Caption = "浏览"
Height = 375
Left = 3720
TabIndex = 17
Top = 2400
Width = 495
End
Begin VB.TextBox Text_MmsFN
Enabled = 0 'False
Height = 375
Left = 120
TabIndex = 16
Top = 2400
Width = 3495
End
Begin VB.TextBox Text_Subject
Height = 375
Left = 120
TabIndex = 14
Top = 1440
Width = 3975
End
Begin VB.TextBox Text_MmsRecvr
Height = 375
Left = 120
TabIndex = 12
Top = 600
Width = 3975
End
Begin VB.Label Label5
Caption = "彩信内容:"
Height = 255
Left = 120
TabIndex = 15
Top = 2040
Width = 1215
End
Begin VB.Label Label4
Caption = "彩信标题:"
Height = 255
Left = 120
TabIndex = 13
Top = 1200
Width = 1335
End
Begin VB.Label Label3
Caption = "接收号码:"
Height = 255
Left = 120
TabIndex = 11
Top = 360
Width = 1335
End
End
Begin VB.Label Label_Device
BorderStyle = 1 'Fixed Single
Height = 375
Left = 4680
TabIndex = 3
Top = 4200
Width = 2655
End
Begin VB.Label Label_Status
BorderStyle = 1 'Fixed Single
Height = 375
Left = 0
TabIndex = 1
Top = 4200
Width = 4695
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command_Browse_Click()
CommonDialog1.Filter = "所有文件 (*.*)|*.*"
CommonDialog1.ShowOpen
Text_MmsFN.Text = CommonDialog1.FileName
End Sub
Private Sub Command_SendSms_Click()
If Text_SmsRecvr.Text = "" Then
MsgBox "接收号码不能为空", vbOKOnly, "消息提示"
Text_SmsRecvr.SetFocus
Exit Sub
End If
If Text_Sms.Text = "" Then
MsgBox "短信内容不能为空", vbOKOnly, "消息提示"
Text_Sms.SetFocus
Exit Sub
End If
Dim ret As Integer
ret = 50
ret = FoxMms1.SendSms(Text_SmsRecvr.Text, Text_Sms, 100)
If ret = 0 Then
Label_Status.Caption = "短信提交成功"
Else
Label_Status.Caption = "短信提交失败"
End If
End Sub
Private Sub Command1_Click()
Dim ret As Integer
ret = 90
ret = FoxMms1.FoxRelease()
While ret <> 0
Wend
End
End Sub
Private Sub Command2_Click()
If Text_MmsRecvr.Text = "" Then
MsgBox "接收号码不能为空", vbOKOnly, "消息提示"
Text_MmsRecvr.SetFocus
Exit Sub
End If
If Text_Subject.Text = "" Then
MsgBox "彩信标题不能为空", vbOKOnly, "消息提示"
Text_Subject.SetFocus
Exit Sub
End If
If Text_MmsFN.Text = "" Then
MsgBox "彩信内容不能为空", vbOKOnly, "消息提示"
Text_MmsFN.SetFocus
Exit Sub
End If
Dim ret As Integer
ret = 50
ret = FoxMms1.SendMms(Text_MmsRecvr.Text, Text_Subject.Text, Text_MmsFN.Text, 20)
If ret = 0 Then
Label_Status.Caption = "彩信提交成功"
Else
Label_Status.Caption = "彩信提交失败"
End If
End Sub
Private Sub Form_Load()
Dim ret As Integer
ret = 100
ret = FoxMms1.FoxInit("E:\", 0, 0)
If ret = 0 Then
Label_Status.Caption = "控件初始化成功"
Else
Label_Status.Caption = "控件初始化失败"
End If
End Sub
Private Sub FoxMms1_DeviceInited(ByVal nDevice As Long, ByVal nStatus As Long)
Label_Device.Caption = "找到" & nDevice & "个设备"
End Sub
Private Sub FoxMms1_MmsSendStatus(ByVal nMsgIndex As Long, ByVal nStatus As Integer)
If nStatus = 0 Then
Label_Status.Caption = "彩信发送成功"
Else
If nStatus = 3 Then
Label_Status.Caption = "彩信会话建立"
End If
End If
End Sub
Private Sub FoxMms1_SmsSendStatus(ByVal nMsgIndex As Long, ByVal nStatus As Long)
If nStatus = 0 Then
Label_Status.Caption = "短信发送成功"
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -