Requires: GfaWinx.lg32
Returns the null-terminated UNICODE string, without the terminating zeros.
wtxt = CharW(adr)
wTxt | : string |
adr | : long expression |
As the built-in function Char{address} the CharW() function returns a string with the contents of a piece of memory starting with address adr until the two terminating zeros are reached. The two termination null characters are not included. The returned string can be passed to Ansi() to convert the UNICODE text to Ansi. The adr parameter must point to a valid UNICODE string. An invalid address might throw an Access Denied exception.
$Library "gfawinx"
Dim pws As Long, sWide As String, sAnsi As String
' Set pws to a valid memory address, for instance
' a value returned from an API function.
sWide = CharW(pws) ' the UNICODE string
sAnsi = Ansi(sWide) ' the ANSI version
The CharW() function is useful when an API function returns a pointer to UNICODE text.
{Created by Sjouke Hamstra; Last updated: 24/08/2021 by James Gaite}