智能家居控制系统VB代码

/*****************************************************************************
* 智能家居控制系统VB上的代码

* 单片机采用AT89S52,晶振频率为:12.00MHz。
/******************************************************************************/
PC上位机调试程序

Private Declare Function TextToSms Lib "SMSDLL.dll" (ByVal csc As String, ByVal ToNum As String, ByVal smsnr As String, ByVal flash As Integer, ByVal reportit As Integer, ByRef sms_len As Integer, ByVal retSms As String) As Integer
Private Declare Function About Lib "SMSDLL.dll" ()
Private Declare Function SmsToText Lib "SMSDLL.dll" (ByVal sms As String, ByVal csca As String, ByRef caca_len, ByVal ToNum As String, ByRef ToNum_len As Integer, ByVal sendtime As String, ByRef time_len As Integer, ByVal smsnr As String) As Integer



Dim i(6) As Byte 'tl
Dim display() As Byte 'tl
Dim test As Byte 'tl
Dim j As Byte



Private Sub Command1_Click()
'将信息编码成一条短消息
Dim s As String
Dim s1 As String
Dim s2 As String
Dim r As Integer
Dim f As Integer
Dim sms_len As Integer
r = CInt(Check1.Value)
f = CInt(Check2.Value)

Dim rsms As String * 400

If Text3.Text = "" Then
MsgBox "请输入短消息内容"
Exit Sub
End If

'rsms = "11111"
ret = TextToSms(Text1.Text, Text2.Text, Text3.Text, r, f, sms_len, rsms)
Text5.Text = "短消息长度:" + CStr(sms_len) & vbCrLf & "PDU内容:" + rsms
MsgBox "总字数:" & ret & vbCrLf & "短消息长度:" + CStr(sms_len) + vbCrLf & "PDU内容:" & rsms

' Dim i
' i = 98
' testit s, s1
' MsgBox s1
End Sub



Private Sub Command2_Click()
'About
Dim csca As String * 30
Dim csca_len As Integer
Dim num As String * 30
Dim num_len As Integer
Dim sendtime As String * 30
Dim time_len As Integer
Dim nr As String * 300
Dim nr_len As Integer

Dim i As Integer
i = SmsToText(Text4.Text, csca, csca_len, num, num_len, sendtime, time_len, nr)
MsgBox "返回值:" & i & vbCrLf & "短消息内容:" & Left(nr, i)
End Sub






Private Sub Command3_Click()

End Sub

Private Sub Command4_Click()
On Error Resume Next
Dim comm As Integer '端口号
comm = GetSetting(App.Title, "setting", "Com", 1)
MSComm1.CommPort = comm
Dim s As String
Dim s1 As String
Dim s2 As String
Dim r As Integer
Dim f As Integer
r = 0
f = 0
Dim sms_len As Integer
If Check1.Value = vbChecked Then
r = 1
Else
r = 0
End If
If Check2.Value = vbChecked Then
f = 1
' MsgBox "f=1"
Else
f = 0
End If



'MsgBox "r= " + r + " f= " + f

'Exit Sub
Dim i As Integer
Dim rsms As String * 400

If Text3.Text = "" Then
MsgBox "请输入短消息内容"
Text3.SetFocus
Exit Sub
End If
If Text2.Text = "" Then
MsgBox "请输入对方手机号码"
Tex

你可能喜欢

  • VB高级编程
  • 智能家居设计
  • vb学生成绩管理系统
  • 酒店方案
  • 酒店管理系统
  • 智能家电控制系统
  • 远程智能家居控制系统

智能家居控制系统VB代码相关文档

最新文档

返回顶部