⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form8.frm

📁 gps全球卫星定位VB源码(部分)请自行准备设备接口
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form8 
   Caption         =   "outputbuff"
   ClientHeight    =   3195
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4680
   LinkTopic       =   "Form8"
   ScaleHeight     =   3195
   ScaleWidth      =   4680
   StartUpPosition =   3  'Windows Default
   Begin VB.CommandButton Command1 
      Caption         =   "送到输出缓冲区"
      Height          =   375
      Left            =   3000
      TabIndex        =   1
      Top             =   2160
      Width           =   1455
   End
   Begin VB.TextBox Text1 
      Height          =   1575
      Left            =   120
      MultiLine       =   -1  'True
      TabIndex        =   0
      Top             =   240
      Width           =   4335
   End
End
Attribute VB_Name = "Form8"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
    Dim Temp_Back  As String
    Dim DDD1 As String
    Dim PDU As String
    Dim Temp_HEAD As String
    Dim Temp_len As String
    Dim Weinum As Integer
    Dim StrCommID As String
    StrCommID = "13608694822F"
    Temp_SendFlag = True
    Temp_HEAD = "AT+CMGS=140" + Chr(13)
    
    If Len(StrCommID) <> 12 Then Exit Sub
    
    MDIMainForm.oComm1.InBufferCount = 0
    
    PDU = "(CTR,000)"
    Weinum = 1
    PDU = AsctoPdu(PDU)
    Temp_len = Hex(Len(PDU) / 2 + Weinum)
    If Len(Temp_len) = 1 Then Temp_len = "0" + Temp_len
    PDU = Temp_len + PDU
    Temp_Back = "0011000D9168" + Trim(StrCommID) + "000000" + PDU + Chr(26) + Chr(13)
    
    Text1.Text = Temp_HEAD + Chr(13)
    Text1.Text = Temp_Back + Chr(13)
    
    MDIMainForm.oComm1.Output = Temp_HEAD    'here is the key
    Sleep (200)
    MDIMainForm.oComm1.Output = Temp_Back
    Sleep (200)
    MDIMainForm.oComm1.InBufferCount = 0
Temp_SendFlag = False
End Sub

Public Function AsctoPdu(ByVal ddd As String) As String
Dim i As Integer
Dim temp_info As Integer
Dim temp_string As String
Dim temp_er() As String
Dim temp_string1 As String
Dim temp_info1 As String
Dim j As Integer
Dim X As Integer
ReDim temp_er(Len(ddd))
For i = 1 To Len(ddd)
    temp_info = Asc(Mid(ddd, i, 1))
    For j = 6 To 0 Step -1
        If temp_info >= 2 ^ j Then
           temp_info = temp_info - 2 ^ j
           temp_er(i) = temp_er(i) + "1"
        Else
           temp_er(i) = temp_er(i) + "0"
        End If
    Next
Next
  
For j = Len(ddd) To X Step -1
    temp_string = temp_string + CStr(temp_er(j))
Next
If Len(temp_string) Mod 8 > 0 Then
   For i = 1 To 8 - Len(temp_string) Mod 8
       temp_string = "0" + temp_string
   Next
End If
For j = Len(temp_string) - 7 To 1 Step -8
  temp_info1 = Hex(ErtoShi(Mid(temp_string, j, 8)))
  If Len(temp_info1) = 1 Then
     temp_string1 = temp_string1 + "0" + temp_info1
  Else
     temp_string1 = temp_string1 + temp_info1
  End If
Next
AsctoPdu = temp_string1
End Function

Private Function ErtoShi(ByVal temp_er As String) As Integer
 Dim i As Integer
 Dim temp_num As String
 For i = 1 To 8
     ErtoShi = ErtoShi + Val(Mid(temp_er, i, 1)) * 2 ^ (8 - i)
 Next
End Function

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -