Bill,

For output string buffers, you should use a StringBuilder parameter, not 
string.

Explicitly calling the ANSI versions of APIs is bad for performance on NT 
based systems. It's better if you let the runtime decide which version to 
call by using CharSet.Auto.

[DllImport("kernel32.dll", CharSet=CharSet.Auto)]
public static extern int GetPrivateProfileString(
   string lpApplicationName, string lpKeyName, string lpDefault,
   System.Text.StringBuilder lpReturnedString, int nSize, string lpFileName);

--

StringBuilder buffer = new StringBuilder( intSize );
intDummy = GetPrivateProfileString( "DBLocation", "Path", null, buffer, 
buffer.Capacity, strINIPath );
strDBLocation = buffer.ToString();


Mattias

===
Mattias Sj�gren
[EMAIL PROTECTED]

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to