🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internationalization
Article #280

Changing the Ansi (Windows) Code Page at Run Time

#280
From: Tom
Date: Thu, 11 Nov 2004 23:48
30 lines
2247 bytes
Hi,

I have an existing GUI program written in C++Builder 5.0 Professional on
Windows 2000 English version and I am in the process of translating it to
simplified Chinese using strings included in a resource file.

For testing the display of the Chinese version I change the user locale and
default system locale using Control Panel Regional Options and do a restart.

Is there any way to change the Ansi (Windows) Code page at run time for an
individual windows program without using Control Panel Regional Options and
doing a restart?  (This would simplify my testing and demonstration
processes).

I tried using setlocale() function but this didn't seem to be useful as when
I called with
setlocale (LC_CTYPE, NULL) it only returned "c".

I tried calling WIN32 function SetThreadLocale() in my WinMain function and
this seemed to change resources returned from resource file to Chinese but
not the display of the characters in Borland controls (ie still ???).
eg SetThreadLocale (MAKELCID (MAKELANGID (LANG_CHINESE,
SUBLANG_CHINESE_SIMPLIFIED), SORT_DEFAULT);

There are WIN32 functions to change the OEM code page for console applns
(eg SetConsoleOutputCP()) but is there an equivalent for changing the ANSI
code page for a windows application at run time?

Best Regards
Tom
Technical Details
Message-ID: <4193fa67$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.wirehub.nl!194.72.7.126.MISMATCH!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 10297d,3672c2d610ef9d20,start
X-Google-Attributes: gid10297d,public
X-Google-Language: ENGLISH,ASCII-7-bit
Reply-To: "Tom" <tomp1456@yahoo.com.au>
From: "Tom" <tomp1456@yahoo.com.au>
Newsgroups: borland.public.cppbuilder.internationalization
Subject: Changing the Ansi (Windows) Code Page at Run Time
Date: Fri, 12 Nov 2004 10:18:28 +1030
Lines: 32
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
NNTP-Posting-Host: 150.101.249.2
Message-ID: <4193fa67$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1100216935 150.101.249.2 (11 Nov 2004 15:48:55 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.wirehub.nl!194.72.7.126.MISMATCH!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail