GetCPInfoExA function (winnls.h)

Retrieves information about any valid installed or available code page.

Syntax

BOOL GetCPInfoExA(
  [in]  UINT        CodePage,
  [in]  DWORD       dwFlags,
  [out] LPCPINFOEXA lpCPInfoEx
);

Parameters

[in] CodePage

Identifier for the code page for which to retrieve information. The application can specify the code page identifier for any installed or available code page, or one of the following predefined values. See Code Page Identifiers for a list of identifiers for ANSI and other code pages.

Value Meaning
CP_ACP
Use the system default Windows ANSI code page.
CP_MACCP
Use the system default Macintosh code page.
CP_OEMCP
Use the system default OEM code page.
CP_THREAD_ACP
Use the current thread's ANSI code page.

[in] dwFlags

Reserved; must be 0.

[out] lpCPInfoEx

Pointer to a CPINFOEX structure that receives information about the code page.

Return value

Returns a nonzero value if successful, or 0 otherwise. To get extended error information, the application can call GetLastError, which can return one of the following error codes:

  • ERROR_INVALID_PARAMETER. Any of the parameter values was invalid.

Remarks

The information retrieved in the CPINFOEX structure is not always useful for all code pages. To determine buffer sizes, for example, the application should call MultiByteToWideChar or WideCharToMultiByte to request an accurate buffer size. If CPINFOEX settings indicate that a lead byte exists, the conversion function does not necessarily handle lead bytes differently, for example, in the case of a missing or illegal trail byte.

Note

The winnls.h header defines GetCPInfoEx as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps | UWP apps]
Minimum supported server Windows 2000 Server [desktop apps | UWP apps]
Target Platform Windows
Header winnls.h (include Windows.h)
Library Kernel32.lib
DLL Kernel32.dll

See also

CPINFOEX

GetACP

GetCPInfo

GetOEMCP

National Language Support

National Language Support Functions