[API]
lstrcpynA
lstrlenA

[CODE]
Public Function PeekS_Ansi(ByVal ptrChar As Long, Optional ByVal MaxLength As Long = -1&) As String
  Dim xLong1 As Long
  
  If Not ptrChar = 0& Then
    If MaxLength = -1& Then MaxLength = &HFFFF&
    xLong1 = lstrlenA(ptrChar)
    If xLong1 > MaxLength Then xLong1 = MaxLength
    PeekS_Ansi = String(xLong1 + 1&, vbNullChar)
    Call lstrcpynA(PeekS_Ansi, ptrChar, xLong1 + 1&)
    PeekS_Ansi = Left(PeekS_Ansi, xLong1)
    End If
  End Function