Share via


IMLangCodePages::CodePagesToCodePage

A version of this page is also available for

Windows Embedded CE 6.0 R3

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 uDefaultCodePage parameter is in the set of code pages specified by the dwCodePages parameter, the method returns the value of the uDefaultCodePage parameter. 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 dwCodePages parameter is 0x1e0000, and the value of the uDefaultCodePage parameter 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 MIMECPINFO structures.

// 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