Discussion:
Switching back to CP_ACP instead of CP_THREAD_ACP
(too old to reply)
Reuven Nisser
2008-01-18 08:32:40 UTC
Permalink
Hi,
MFC conversions between Unicode and non-Unicode pages are done now using
CP_THREAD_ACP instead of CP_ACP. Is there a way to change back to CP_ACP?

I tried defining _CONVERSION_DONT_USE_THREAD_LOCALE but it does not
apply to MFC DLL. I do not want to re-compile the DLL and redistribute it.

I tried changing the pointer g_pfnGetThreadACP (atlconv.h) to point to a
routine returning CP_ACP. However, it seems my program contains a
different variable g_pfnGetThreadACP than the one MFC uses. Maybe
there's a way to link to MFC variable?

From programming point of view, is there a way to change CP_THREAD_ACP?
I mean changing the "ANSI code page for the current thread"?

Thanks,
Reuven Nisser
Serge Wautier
2008-01-18 10:39:41 UTC
Permalink
Hi Reuven,

I guess CP_THREAD_ACP resolves to the thread's current locale. Doesn't it
make sense that conversions are made according to the thread's settings? I'd
say yes.
You can change the thread locale using... SetThreadLocale(). By default, the
thread locale is of course the same as the system locale.

HTH,

Serge.
http://www.apptranslator.com - Localization tool for your MFC applications
Post by Reuven Nisser
Hi,
MFC conversions between Unicode and non-Unicode pages are done now using
CP_THREAD_ACP instead of CP_ACP. Is there a way to change back to CP_ACP?
I tried defining _CONVERSION_DONT_USE_THREAD_LOCALE but it does not apply
to MFC DLL. I do not want to re-compile the DLL and redistribute it.
I tried changing the pointer g_pfnGetThreadACP (atlconv.h) to point to a
routine returning CP_ACP. However, it seems my program contains a
different variable g_pfnGetThreadACP than the one MFC uses. Maybe there's
a way to link to MFC variable?
From programming point of view, is there a way to change CP_THREAD_ACP? I
mean changing the "ANSI code page for the current thread"?
Thanks,
Reuven Nisser
Reuven Nisser
2008-01-18 20:22:06 UTC
Permalink
Hi Serge,
Thanks, I will check if SetThreadLocale() solves my problem.

I would like to explain the situation:

In "Regional Settings" dialog, at the "Advanced" tab you can select the
language for the non-Unicode programs at system level (CP_ACP).

At the "Regional Options" tab you can select the preferences for
standards and formats. This option selects also the CP_THREAD_ACP.

However, many English speaking users in Israel want to work in English
but to be able to enter Hebrew text. So, the set CP_ACP to Hebrew, and
they need to select "English (Israel)" as preferences. However, this
option is not available so they get CP_THREAD_ACP set to English.

Windows controls act using CP_ACP so it's not a problem but MFC 7 users
have a problem.

Regards,
Reuven Nisser
Reuven Nisser
2008-01-18 23:05:46 UTC
Permalink
Hi Serge again,
I checked SetThreadLocale() and it seems to do much more than I need. In
fact, too much. I only need to change CP_THREAD_ACP and not the rest of
the locale settings.
Any idea?
Thanks, Reuven
Serge Wautier
2008-01-19 15:11:11 UTC
Permalink
Reuven,

The best idea I can come up with is to recommend to post again to
microsoft.public.win32.programmer.international ;-)

HTH,

Serge.
http://www.apptranslator.com - Localization tool for your MFC applications
Post by Reuven Nisser
Hi Serge again,
I checked SetThreadLocale() and it seems to do much more than I need. In
fact, too much. I only need to change CP_THREAD_ACP and not the rest of
the locale settings.
Any idea?
Thanks, Reuven
i***@gmail.com
2017-04-24 09:06:55 UTC
Permalink
it was here?
http://microsoft.public.win32.programmer.international.narkive.com/jwM2bzeK/switching-back-to-cp-acp-instead-of-cp-thread-acp

What is in result?
Post by Serge Wautier
Reuven,
The best idea I can come up with is to recommend to post again to
microsoft.public.win32.programmer.international ;-)
HTH,
Serge.
http://www.apptranslator.com - Localization tool for your MFC applications
Post by Reuven Nisser
Hi Serge again,
I checked SetThreadLocale() and it seems to do much more than I need. In
fact, too much. I only need to change CP_THREAD_ACP and not the rest of
the locale settings.
Any idea?
Thanks, Reuven
Loading...