AccessViolationException beim Ausführen von WritePrivateProfileString
-
Hallo,
bekomme in meinem .NET Projekt beim Ausführen der Zeile
bWriteResult &= WritePrivateProfileString((LPCWSTR)CONF_SEC_GENERAL_NAME, (LPCWSTR)CONF_KEY_SEPARATOR_NAME, (LPCWSTR)*PtrToStringChars(this->SeparatorEdit->Text), (LPCWSTR)CONF_FILE_NAME);
die Fehlermeldung
Eine Ausnahme (erste Chance) des Typs "System.AccessViolationException" ist in xxx.exe aufgetreten.
Mit WritePrivateProfileString schreibt man etwas in eine ini-Datei. Die großgeschriebenen Bezeichner sind defines, die Strings beinhalten.
Ich vermute das ich beim casten etwas falsch mache oder?Im Voraus schonmal danke für Eure Hilfe!
Gruß,
Korkenzieherjoe
-
Was ist
CONF_SEC_GENERAL_NAME
und warum wird es nachLPCWSTR
gecastet? Und das Resultat vonPtrToStringChars
ist einvolatile cli::pin_ptr<const wchar_t>
; so etwas einfach nachLPCWSTR
zu casten scheint mir auch nur bedingt sinnvoll...MfG