Visual Basic Concepts
Many Windows API and DLL functions return size in bytes. This return value represents the size of the returned string. Visual Basic converts the returned string into Unicode even though the return value still represents the size of the ANSI or DBCS string. Therefore, you may not be able to use this returned size as the string's size. The following code gets the returned string correctly:
buffer = String(145, Chr(" ")) ret = GetPrivateProfileString(section, _ entry, default, buffer, Len(buffer)-1, filename) retstring = Left(buffer, Instr(buffer, Chr(0))-1))
For More Information For more information, see "Accessing the Microsoft Windows API" in "Accessing DLLs and the Windows API" of the Component Tools Guide, available in the Professional and Enterprise editions.