When using WindowsAPI, if the function returns a string, it will always be returned with a whole load of null characters after the actual text. You can use this simple function to get rid of them!
Function StripTerminator(ByVal strString As String) As String
Dim intZeroPos As Integer
intZeroPos = InStr(strString, Chr$(0))
If intZeroPos > 0 Then
StripTerminator = left$(strString,
intZeroPos - 1)
Else
StripTerminator = strString
End If
End Function
Comments