楼主最近还看过
能帮忙解释一下代码吗?谢谢
Function ChgDeviceString(szDevice As String) As String
Dim lCnt As Long
On Error GoTo Error
ChgDeviceString = ""
For lCnt = 1 To Len(szDevice)
If (Mid$(szDevice, lCnt, 1) <> vbCr) Then
ChgDeviceString = ChgDeviceString + Mid$(szDevice, lCnt, 1)
End If
Next
Exit Function
Error:
ErrMsg = Error$(Err)
MsgBox ErrMsg, vbCritical
End
End Function
Function ChgDeviceData(lSize As Long, szData As String, lplData() As Long)
Dim lCnt As Long
Dim lPos As Long
Dim szBuf As String
On Error GoTo Error
szBuf = ""
lCnt = 0
For lPos = 1 To Len(szData)
If (lCnt >= lSize) Then
Exit For
End If
If (Mid$(szData, lPos, 2) = (vbCrLf)) Then
If (IsNumeric(szBuf) = True) Then
lplData(lCnt) = CLng(szBuf)
Else
lplData(lCnt) = 0
End If
lPos = lPos + 1
lCnt = lCnt + 1
szBuf = ""
Else
szBuf = szBuf + Mid$(szData, lPos, 1)
If (lPos = Len(szData)) Then
If (IsNumeric(szBuf) = True) Then
lplData(lCnt) = CLng(szBuf)
Else
lplData(lCnt) = 0
End If
End If
End If
Next
Exit Function
Error:
ErrMsg = Error$(Err)
MsgBox ErrMsg, vbCritical
End
End Function
?