module1.bas

来自「基于VB、Access、研华IO模块、Gprs模块的远程监控系统」· BAS 代码 · 共 29 行

BAS
29
字号
Attribute VB_Name = "Module1"
Dim passwordflag As Boolean
Declare Function GetTickCount Lib "kernel32" () As Long
Sub timedelay(t As Long)
Dim tt As Long
   tt = GetTickCount()
Do
  DoEvents
Loop Until GetTickCount() - tt >= t
End Sub

Function waitRS(comm As MSComm, RS As String, DT As Long) As String

Dim buf As String, tt As Long
    buf = ""
    tt = GetTickCount
    
    Do
      buf = buf & comm.Input
    Loop Until InStr(1, buf, RS) > 0 Or GetTickCount - tt >= DT
    
    If InStr(1, buf, RS) > 0 Then
      waitRS = buf
    Else
    waitRS = ""
    End If
    
End Function

⌨️ 快捷键说明

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