Metrohm 846 Driver Toolbox User Manual
Page 53

3.1 Programming interface definitions
Dosing Interface USB Toolbox, Annex
49
Private Function TruncString(ByVal s As String) As String
Dim l As Long
l = InStr(s, Chr(0))
If (l > 0) Then
TruncString = Left(s, l - 1)
Else
TruncString = s
End If
End Function
' Reads casual error messages which occur during Dosino actions.
'
' parameter Long IfNo Dosing Interface [1... ?]
' Long MsbNo Dosino at MSB [1... 4]
' Long ErrorNumber Error number [0... 9]
' String ByRef ErrorCode Error code, format
' [GGG-CCC-K-III],
' G = group, C = code,
' K = class, I = index
' (1...4 or 255)
' return eReturnstate
Public Function GetInterfaceError(ByVal IfNo As Long, ByVal MsbNo As Long, _
ByVal ErrorNumber As Long, ByRef ErrorCode As String) As eReturnState
Dim temp As String
temp = String(255, vbNullChar)
GetInterfaceError = GetErr(IfNo, MsbNo, ErrorNumber, temp, 255)
ErrorCode = TruncString(temp)
End Function
' Get the program version of the 846 Dosing Interface
'
' parameter Long IfNo Dosing Interface [1... ?]
' String ByRef ProgramVersion Text string of program version
' return eReturnstate
Public Function GetProgramVersion(ByVal IfNo As Long, _
ByRef ProgramVersion As String) As eReturnState
Dim temp As String
temp = String(255, vbNullChar)
GetProgramVersion = GetProgVer(IfNo, temp, 255)
ProgramVersion = TruncString(temp)
End Function