Re: Pointer to a Unicode string - returned by API call



"Lester" <vocalise27@xxxxxxxxx> wrote in message
news:1117163273.498690.235450@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
[...]
> Now MIB_IFROW has a member wszName [MAX_INTERFACE_NAME_LEN] which is a
> "Pointer to a Unicode string that contains the name of the interface".
> How do I read this out from the memory, and put in (eg.) a TStrings?

The same way you would for a normal PChar to a long string, mostly.
SetLength your Delphi WideString variable to the required length, and
Move() bytes from [the first character in] the source to [the first
character in] the destination. Watch out for strings SetLength'ed to
zero.

TStrings contains ANSI strings, not wide strings. Characters not present
in your active codepage will become question marks in conversion.

Groetjes,
Maarten Wiltink


.



Relevant Pages

  • Re: Unicode Support
    ... > Not knowing much about UTF-8 (my Unicode knowledge extends as far as ... > literal strings of this form as long as the character code for quote ... > can never appear in a MBCS (multibyte character sequence). ... then XP Notepad directly understands UNICODE and you can ...
    (alt.lang.asm)
  • Re: Need help on string manipulation
    ... better to convert strings to UCS-32 before manipulation? ... Characters represented by wchar_t must use one wchar_t per character, ... which may use a multibyte encoding. ... use some newer Unicode characters, if this is a problem for you, then ...
    (comp.lang.c)
  • Re: Copying string to byte array
    ... of Strings and the CryptEncrypt + CryptDecrypt APIs. ... binary data should not be held in String variables. ... a) not all character codes are valid in a given ...
    (microsoft.public.vb.general.discussion)
  • Re: Unicode Support
    ... >> but labels. ... > character) are considered "invalid"... ... form from which you can compare strings. ... normalization forms -- compatible and canonical. ...
    (alt.lang.asm)
  • Re: GetOpenFilename()
    ... Specifies that the File Name list box allows multiple selections. ... the directory and file name strings are NULL ... You advance the pointer one character more. ...
    (microsoft.public.vc.language)