The confusion about the variable being typed as Long happens because C only needs a starting address for the string. The terminating byte(s) must be zero - no bits set. C starts with the first byte and continues to read memory sequentially until a string terminator is encountered, one byte for ANSI or two bytes for Unicode. Strings that use a length byte as known as Basic Strings, abbreviated BSTR. Standard C strings do not have a length byte as do VBA strings. If the string in C is Unicode it will have the prefix "pwzs" for pointer to wide string zero terminated. Now, the prefix "psz" in C indicates the variable is a pointer (memory address) to a zero terminated string. So unless you are creating code that needs to handle Unicode glyphs, just use the "A" version of the function. "A" is for ANSI and "W" is for Wide Character, the C name for Unicode. These suffixes indicate the string data type the function expects. The API can sometimes have two flavors of a function: A or W. If you're not familiar with "C" then translating from "C" to VBA can be difficult or impossible. The Windows API code is written in the "C" language.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |