Andrew,
I have not specifically used the function, however the following works:
Declare Auto Function IsTextUnicode Lib "Advapi32" (ByVal buffer() As
Byte, ByVal length As Integer, ByRef options As IsTextUnicodeFlags) As
Boolean
<Flags()> _
Public Enum IsTextUnicodeFlags As Integer
Ascii16 = &H1
ReverseAscii16 = &H10
Statistics = &H2
ReverseStatistics = &H20
Controls = &H4
ReverseControls = &H40
Signature = &H8
ReverseSignature = &H80
IllegalChars = &H100
OddLength = &H200
DbcsLeadbyte = &H400
NullBytes = &H1000
UnicodeMask = &HF
ReverseMask = &HF0
NotUnicodeMask = &HF00
NotAsciiMask = &HF000
End Enum
Public Shared Sub Main()
Dim str As String = "Hello world"
Dim buffer() As Byte
Dim options As IsTextUnicodeFlags
buffer = System.Text.Encoding.Unicode.GetBytes(str)
options = IsTextUnicodeFlags.UnicodeMask
Debug.WriteLine(Nothing)
Debug.WriteLine(IsTextUnicode(buffer, buffer.Length, options),
"isTextUnicode")
Debug.WriteLine(options, "options")
buffer = System.Text.Encoding.Default.GetBytes(str)
options = IsTextUnicodeFlags.UnicodeMask
Debug.WriteLine(Nothing)
Debug.WriteLine(IsTextUnicode(buffer, buffer.Length, options),
"isTextUnicode")
Debug.WriteLine(options, "options")
buffer = New Byte() {&H41, &HA, &HD, &H1D}
options = IsTextUnicodeFlags.UnicodeMask
Debug.WriteLine(Nothing)
Debug.WriteLine(IsTextUnicode(buffer, buffer.Length, options),
"isTextUnicode")
Debug.WriteLine(options, "options")
End Sub
Hope this helps
Jay