Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

This method retrieves the identifier value for a code page in the given set of code pages.

Syntax

HRESULT CodePagesToCodePage( 
  DWORD 
dwCodePages,
  UINT 
uDefaultCodePage,
  UINT* 
puCodePage
);

Parameters

dwCodePages

[in] Specifies the source set of code pages.

uDefaultCodePage

[in] Default code page to look for in the set.

puCodePage

[out] Pointer to an unsigned integer where the code page identifier value is returned.

Return Value

Returns S_OK if successful or E_FAIL if an error occurs.

Remarks

For more information about sets of code pages, see IMLangCodePages.

If the code page specified by the uDefaultCodePageparameter is in the set of code pages specified by the dwCodePagesparameter, the method returns the value of the uDefaultCodePageparameter. If no default code page is given, the method returns the code page identifier value corresponding to the least significant bit that has been set to 1. For example, if the value of the dwCodePagesparameter is 0x1e0000, and the value of the uDefaultCodePageparameter is not in the set, the method returns the code page that corresponds to the bit 0x020000.

Example Code

The following example shows the syntax for converting a set of code pages into an array of corresponding MIMECPINFOstructures.

Copy Code
// dwCodePages - DWORD representing a set of code pages.
// pcpInfo - caller-allocated array of MIMECPINFO structures.
// pMultiLanguage - pointer to an IMultiLanguage interface.
// pMLangCodePages - pointer to an IMLangCodePages interface.
for(int i = 0; dwCodePages; i++)
{
	UINT uCodePage;
	DWORD dwTemporaryCodePages;
	pMLangCodePages->CodePagesToCodePage(dwCodePages, CP_ACP,
		&uCodePage);
	pMultiLanguage->GetCodePageInfo(uCodePage, pcpInfo + i);
	pMLangCodePages->CodePageToCodePages(uCodePage,
		&dwTemporaryCodePages);
	dwCodePages &= ~dwTemporaryCodePages;
}

Requirements

Header mlang.h, mlang.idl
Library mlang.dll
Windows Embedded CE Windows CE .NET 4.0 and later
Windows Mobile Windows Mobile Version 5.0 and later