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

📄 form1.frm

📁 主要功能:接收和发送短信
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   3090
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   ScaleHeight     =   3090
   ScaleWidth      =   4680
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command2 
      Caption         =   "Command2"
      Height          =   405
      Left            =   2325
      TabIndex        =   1
      Top             =   1320
      Width           =   1410
   End
   Begin VB.CommandButton Command1 
      Caption         =   "Command1"
      Height          =   525
      Left            =   1095
      TabIndex        =   0
      Top             =   1185
      Width           =   855
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public Function QpDecode(inString As String) As String
Dim myB As Byte
Dim myByte1 As Byte, myByte2 As Byte
Dim convStr() As Byte
Dim mOutByte As Byte
Dim FinishPercent As Long
Dim TotalB, k As Long
Dim tmpByte As Byte

convStr = StrConv(inString, vbFromUnicode)

TotalB = UBound(convStr)
For k = 0 To TotalB
   myB = convStr(k)
   If myB = Asc("=") Then
      k = k + 1
      myByte1 = convStr(k)
      If myByte1 = &HA Then
            '如果是回车,继续
      Else
            '取第二个字节
         k = k + 1
         myByte2 = convStr(k)
         Call DecodeByte(myByte1, myByte2, mOutByte)
         If mOutByte >= 127 Then
            If tmpByte <> 0 Then
               QpDecode = QpDecode & Chr(Val("&H" & Hex(tmpByte) & Hex(mOutByte)))
               tmpByte = 0
            Else
               tmpByte = mOutByte
            End If
         Else
            QpDecode = QpDecode & Chr(mOutByte)
            tmpByte = 0
         End If
      End If
    Else
        mOutByte = myB
        QpDecode = QpDecode & Chr(mOutByte)
    End If
Next
End Function
Private Sub DecodeByte(mInByte1 As Byte, mInByte2 As Byte, mOutByte As Byte)
Dim tbyte1 As Integer, tbyte2 As Integer
If mInByte1 > Asc("9") Then
    tbyte1 = mInByte1 - Asc("A") + 10
Else
    tbyte1 = mInByte1 - Asc("0")
End If
If mInByte2 > Asc("9") Then
    tbyte2 = mInByte2 - Asc("A") + 10
Else
    tbyte2 = mInByte2 - Asc("0")
End If
mOutByte = tbyte1 * 16 + tbyte2
End Sub

Private Sub EncodeByte(mInByte As Byte, mOutStr As String)
If (mInByte >= 33 And mInByte <= 60) Or (mInByte >= 62 And mInByte <= 126) Then
    mOutStr = Chr(mInByte)
Else
    If mInByte <= &HF Then
        mOutStr = "=0" & Hex(mInByte)
    Else
        mOutStr = "=" & Hex(mInByte)
    End If
End If
End Sub

Public Function QpEncode(inString As String) As String
Dim myB As Byte
Dim convByte() As Byte
Dim mOutStr As String
Dim FinishPercent As Long
Dim TotalB, k As Long

convByte = StrConv(inString, vbFromUnicode)

TotalB = UBound(convByte)
For k = 0 To TotalB
    myB = convByte(k)
    EncodeByte myB, mOutStr
    QpEncode = QpEncode & mOutStr
Next
End Function

Private Sub Command1_Click()
MsgBox QpDecode("=B2=E2=CA=D4=D2=BB")
End Sub

Private Sub Command2_Click()
MsgBox QpEncode("测试一")
End Sub

⌨️ 快捷键说明

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