From: Giovanni Dicanio on
Joseph M. Newcomer ha scritto:
> On my Vista machine, EnumCodePages creates a subset of the list you cite. Missing or with
> errors are

Thanks Joe.

I ignored the existance of the IMultiLanguage::EnumCodePages method.

Giovanni

From: Joseph M. Newcomer on
So did I. I was suggesting the ::EnumCodePages API.
joe
On Thu, 10 Sep 2009 16:47:15 +0200, Giovanni Dicanio
<giovanniDOTdicanio(a)REMOVEMEgmail.com> wrote:

>Joseph M. Newcomer ha scritto:
>> On my Vista machine, EnumCodePages creates a subset of the list you cite. Missing or with
>> errors are
>
>Thanks Joe.
>
>I ignored the existance of the IMultiLanguage::EnumCodePages method.
>
>Giovanni
Joseph M. Newcomer [MVP]
email: newcomer(a)flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
From: Giovanni Dicanio on
Joseph M. Newcomer ha scritto:

> So did I. I was suggesting the ::EnumCodePages API.

When I insert EnumCodePages in Google to search it, I only find the
IMultiLanguage::EnumCodePages method.

Giovanni
From: Joseph M. Newcomer on
Sorry, I had misremembered the API: EnumSystemCodePages

The code generated by Locale Explorer

// static BOOL CALLBACK EnumCodePagesProc(LPTSTR); // add this to your class definition
/* static */ BOOL CALLBACK EnumCodePagesProc(LPTSTR codepage)
{
int cp = ::_ttoi(codepage);
// use either 'codepage' or 'cp' here
return TRUE;
} // EnumCodePagesProc

if(!EnumSystemCodePages(EnumCodePagesProc, CP_INSTALLED ))
{ /* error */
DWORD err = ::GetLastError();
// .. handle the error here
} /* error */

joe

On Fri, 11 Sep 2009 00:47:26 +0200, Giovanni Dicanio
<giovanniDOTdicanio(a)REMOVEMEgmail.com> wrote:

>Joseph M. Newcomer ha scritto:
>
>> So did I. I was suggesting the ::EnumCodePages API.
>
>When I insert EnumCodePages in Google to search it, I only find the
>IMultiLanguage::EnumCodePages method.
>
>Giovanni
Joseph M. Newcomer [MVP]
email: newcomer(a)flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
From: Mihai N. on
> I want to present a list of windows code pages to the user, much like in
> internet explorer when you select the encoding from the context menu.
>
> Is there an API to return the list of windows code pages?

See the posts from Joe and Giovanni.
But you should be consistent!

If you go with EnumSystemCodePages (Win32 API), you should convert
with MultiByteToWideChar (Win32 API).

But if you go with IMultiLanguage::EnumCodePages (MLang API),
you should convert with the stuff under IMLangConvertCharset (MLang API).

Can also take a look at IMultiLanguage2
(ConvertString*, CreateConvertCharset, GetCharsetInfo,
GetCodePageDescription, GetCodePageInfo, GetFamilyCodePage,
GetNumberOfCodePageInfo) for extras

If you need something exactly like IE, then go with
IMultiLanguage/IMultiLanguage2 (because IE uses MLang).


--
Mihai Nita [Microsoft MVP, Visual C++]
http://www.mihai-nita.net
------------------------------------------
Replace _year_ with _ to get the real email