GetOpenFileName changes the setting of setlocale
Hello,
we use Visual Studio 2005 UNICODE. We found out that opening a file
selection dialog changes the current local setting. We didnt have this
problem with Visual Studio 2003 non UNICODE.
Code Example:
void C_L10N::TraceLocale(const T_STRING &TraceText)
{
TRACE_NOCHECK(TraceText << L"Aktuelle Einstellung f??r locale\n" <<
_wsetlocale(LC_ALL, 0));
TRACE_NOCHECK(L"Aktuelle Einstellung f??r mbcp\n" << _getmbcp());
}
C_WINTOOL::GetL10N().TraceLocale(L"Vor: Test\n");
CFileDialog Dialog(TRUE, L"ELE", NULL, OFN_HIDEREADONLY |
OFN_ENABLESIZING | OFN_NOCHANGEDIR, GetDateLine().Str());
Dialog.m_ofn.lpstrTitle = L"Meiner !!!!";
Dialog.DoModal();
C_WINTOOL::GetL10N().TraceLocale(L"Nach: Test\n");
Output:
[12:04:40] Vor: Test
Aktuelle Einstellung f??r locale
LC_COLLATE=C;LC_CTYPE=C;LC_MONETARY=C;LC_NUMERIC=English_United
States.1252;LC_TIME=German_Germany.1252
[12:04:40] Aktuelle Einstellung f??r mbcp
0
[12:05:11] Nach: Test
Aktuelle Einstellung f??r locale
German_Germany.1252
[12:05:11] Aktuelle Einstellung f??r mbcp
0
Why the hell is the settig changed by a SDK call? I changed the code and so
i found out that the setting is okey till i call ::GetOpenFileName()
What can we do to ensure that the Setting we choose for the application is
not changed during runtime?