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] Source set of code pages.
- uDefaultCodePage
- [in] Default code page to look for in the set.
- puCodePage
- [out] Address of 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
See IMLangCodePages for more information about sets of code pages.
If uDefaultCodePage is in the set of code pages specified by dwCodePages, the method returns uDefaultCodePage. 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 dwCodePages is 0x1e0000, and uDefaultCodePage is not in the set, the method returns the code page that corresponds to the bit 0x020000.
Windows CE
Windows CE Use version 2.12 and later Minimum availability Internet Explorer 4.0
Example
This example shows how to convert 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; }
See Also