#include once "window9.bi"
Function Read_String (ByVal H As handle) As String Export
  Dim buf As Byte
  Dim buff As Byte
  Dim rez As String
  Do
    ReadFile(H, @buf, 1, Cast(LPDWORD,@buff), 0)
    If buf<>13 and buf<>10 Then
      If buff=0 Then Exit do
      rez=rez & Chr(buf)
    EndIf
    If buff=0 Or buf=10 Then Exit do
  Loop
  Return rez
End Function
