[CODE]
Public Function TxtFile_GetEncoding(ByRef hTxtFile As Long) As TxtFile_EncodingEnum
  Dim xType1 As TxtFileReadStruct

  If Not hTxtFile = 0& Then
    Call RtlMoveMemory(xType1, ByVal hTxtFile, TxtFileReadStructLen)
    If Not xType1.hMem = 0& Then
      TxtFile_GetEncoding = xType1.Encoding
      End If
    End If
  End Function