L
Lalasa
I got GetPrivateProfileString to work using interop, but there is
something that is bugging me.
This is the syntax provided on Pinvoke.net
[DllImport("kernel32.dll")]
static extern uint GetPrivateProfileString(
string lpAppName,
string lpKeyName,
string lpDefault,
StringBuilder lpReturnedString,
uint nSize,
string lpFileName);
Why should lpReturnedString be a StringBuilder type?
Why doesn't the syntax below work?
[DllImport("kernel32.dll")]
static extern uint GetPrivateProfileString(
string lpAppName,
string lpKeyName,
string lpDefault,
[MarshalAs(UnmanagedType.LPTStr)] string lpReturnedString,
uint nSize,
string lpFileName);
MSDN documentation is as below:
DWORD GetPrivateProfileString(
LPCTSTR lpAppName,
LPCTSTR lpKeyName,
LPCTSTR lpDefault,
LPTSTR lpReturnedString,
DWORD nSize,
LPCTSTR lpFileName
);
Thanks,
Lalasa.
something that is bugging me.
This is the syntax provided on Pinvoke.net
[DllImport("kernel32.dll")]
static extern uint GetPrivateProfileString(
string lpAppName,
string lpKeyName,
string lpDefault,
StringBuilder lpReturnedString,
uint nSize,
string lpFileName);
Why should lpReturnedString be a StringBuilder type?
Why doesn't the syntax below work?
[DllImport("kernel32.dll")]
static extern uint GetPrivateProfileString(
string lpAppName,
string lpKeyName,
string lpDefault,
[MarshalAs(UnmanagedType.LPTStr)] string lpReturnedString,
uint nSize,
string lpFileName);
MSDN documentation is as below:
DWORD GetPrivateProfileString(
LPCTSTR lpAppName,
LPCTSTR lpKeyName,
LPCTSTR lpDefault,
LPTSTR lpReturnedString,
DWORD nSize,
LPCTSTR lpFileName
);
Thanks,
Lalasa.