I need to convert LPTSTR to String^ for be able to view it via MessageBox;
LPTSTR szResult;
DWORD language = GetPrivateProfileString(L"LANGUAGE", L"LANGUAGE", L"", szResult, 255, L"\\file.ini");
System::String^ str_buffed = msclr::interop::marshal_as<System::String^>(szResult);
MessageBox::Show("CLR MessageBox", str_buffed, MessageBoxButtons::OK, MessageBoxIcon::Exclamation);
Am I doing it in good way? Because I got en exception: System.AccessViolationException - Attempting to read the protected memory
How can I read in other way ini file and convert it (returns) to String^ ?