G Guest Mar 24, 2004 #1 How can pass a System::String* variable to a Win32 API? how can I convert the System::String* to LPCSTR ????
How can pass a System::String* variable to a Win32 API? how can I convert the System::String* to LPCSTR ????
W William DePalo [MVP VC++] Mar 24, 2004 #2 Mark said: How can pass a System::String* variable to a Win32 API? how can I convert the System::String* to LPCSTR ???? Click to expand... Take a look at this link and scroll down to "Converting Managed Strings ....": http://msdn.microsoft.com/msdnmag/issues/02/02/managedc/default.aspx Regards, Will
Mark said: How can pass a System::String* variable to a Win32 API? how can I convert the System::String* to LPCSTR ???? Click to expand... Take a look at this link and scroll down to "Converting Managed Strings ....": http://msdn.microsoft.com/msdnmag/issues/02/02/managedc/default.aspx Regards, Will
J Julie Mar 24, 2004 #3 Nadav said: Use const wchar_t __pin* pUnmanagedString = PtrToStringChars(pManagedString); Nadav. Click to expand... This is only suitable *IF* the string is temporarily referenced (and then unreferenced and released). Otherwise, the string is 'pinned' in the heap, and can lead to sandbar and similar fragmentation issues in the GC heap.
Nadav said: Use const wchar_t __pin* pUnmanagedString = PtrToStringChars(pManagedString); Nadav. Click to expand... This is only suitable *IF* the string is temporarily referenced (and then unreferenced and released). Otherwise, the string is 'pinned' in the heap, and can lead to sandbar and similar fragmentation issues in the GC heap.
G Guest Mar 26, 2004 #4 Heres an example prototype to call a Windows API function [DllImport("kernel32", CharSet=CharSet::Auto) Int32 WritePrivateProfileString(String* pAppName, String* pKeyName, String* pString, String *pFilename);
Heres an example prototype to call a Windows API function [DllImport("kernel32", CharSet=CharSet::Auto) Int32 WritePrivateProfileString(String* pAppName, String* pKeyName, String* pString, String *pFilename);