[Emergency!] How to set system default language by code?

W

WizardLee

Hi, all,


A new feature is required to add to my program today. But I do not have any
idea about it.
The feature should implement these two functions:

1, Select "Install files for East Asia languages" in control panel
applet "Regional and Language Option" in "Language" tabpage, then apply;

2, According to user's selection, choose "Chinese (PRC)" or "Chinese
(TaiWan)" or something else for "Non-unicode application language" in
"Advanced" tabpage, then apply;

This feature may require Windows setup CD and may need reboot.


Thans very very very much!
WizardLee
 
W

WizardLee

Sorry. There is something wrong in the question:
The end-user'd better can not see the control panel applet.
I thought there should be some API function like SetSystemDefault... But I
can not find.
 
W

WizardLee

Thank you. But:

SetThreadLocal() only set the settings of "current thread", but not the
system default settings.

_setmbcp() does not take effect.

And, even if some function take effect, how could I know which files should
copy to where? Or is the function tell the end-user?
 
P

Pavel A.

Not a vc or mfc issue.
Please post in microsoft.public.windowsxp.configuration_manage and microsoft.public.windowsxp.setup_deployment
(assuming your OS is XP)
 
N

news.microsoft.net

But does microsoft.public.windowsxp.configuration_manage or
microsoft.public.windowsxp.setup_deployment discuss program issue?
I am want to set the default language "in my vc++ applicaiton", not manually
in control panel.
 
F

Ferdinand Oeinck

I use:

char szLang[32];
char szCountry[32];
char szCodePage[32];

if (GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SENGLANGUAGE,
szLang, sizeof(szLang)) > 0)
{
if (GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SENGCOUNTRY,
szCountry, sizeof(szCountry)) > 0)
{
if (GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_IDEFAULTANSICODEPAGE,
szCodePage, sizeof(szCodePage)) > 0)
{
CString loc;
loc.Format("%s_%s.%s", szLang, szCountry, szCodePage);
setlocale(LC_ALL, loc);
}
}
}

Ferdinand.
 
W

WizardLee

These functions get settings in "Regional Options" tabpage, but not the
"Advanced" tabpage.

For example, in a English WinXP. The UI are english. Install East Asia
support files and set non-unicode encoding to "Chinese(PRC)" in control
panel. These functions will still return English.


Ferdinand Oeinck said:
I use:

char szLang[32];
char szCountry[32];
char szCodePage[32];

if (GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SENGLANGUAGE,
szLang, sizeof(szLang)) > 0)
{
if (GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SENGCOUNTRY,
szCountry, sizeof(szCountry)) > 0)
{
if (GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_IDEFAULTANSICODEPAGE,
szCodePage, sizeof(szCodePage)) > 0)
{
CString loc;
loc.Format("%s_%s.%s", szLang, szCountry, szCodePage);
setlocale(LC_ALL, loc);
}
}
}

Ferdinand.


WizardLee said:
Hi, all,


A new feature is required to add to my program today. But I do not have any
idea about it.
The feature should implement these two functions:

1, Select "Install files for East Asia languages" in control panel
applet "Regional and Language Option" in "Language" tabpage, then apply;

2, According to user's selection, choose "Chinese (PRC)" or "Chinese
(TaiWan)" or something else for "Non-unicode application language" in
"Advanced" tabpage, then apply;

This feature may require Windows setup CD and may need reboot.


Thans very very very much!
WizardLee
 
F

Ferdinand Oeinck

You could try:
LOCALE_IDEFAULTCODEPAGE
or an other value supported by GetLocaleInfo. You can read it on MSDN, I
suppose...
Ferdinand.


WizardLee said:
These functions get settings in "Regional Options" tabpage, but not the
"Advanced" tabpage.

For example, in a English WinXP. The UI are english. Install East Asia
support files and set non-unicode encoding to "Chinese(PRC)" in control
panel. These functions will still return English.


Ferdinand Oeinck said:
I use:

char szLang[32];
char szCountry[32];
char szCodePage[32];

if (GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SENGLANGUAGE,
szLang, sizeof(szLang)) > 0)
{
if (GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SENGCOUNTRY,
szCountry, sizeof(szCountry)) > 0)
{
if (GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_IDEFAULTANSICODEPAGE,
szCodePage, sizeof(szCodePage)) > 0)
{
CString loc;
loc.Format("%s_%s.%s", szLang, szCountry, szCodePage);
setlocale(LC_ALL, loc);
}
}
}

Ferdinand.


WizardLee said:
Hi, all,


A new feature is required to add to my program today. But I do not
have
any
idea about it.
The feature should implement these two functions:

1, Select "Install files for East Asia languages" in control panel
applet "Regional and Language Option" in "Language" tabpage, then apply;

2, According to user's selection, choose "Chinese (PRC)" or "Chinese
(TaiWan)" or something else for "Non-unicode application language" in
"Advanced" tabpage, then apply;

This feature may require Windows setup CD and may need reboot.


Thans very very very much!
WizardLee
 
P

Pavel A.

If I understood your question correctly, you want to change the global system
configuration, and this change should persist after your program exits.
Please correct me if this is wrong.

- PA
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top