EnumSystemCodePagesA function (winnls.h)

Enumerates the code pages that are either installed on or supported by an operating system.

Syntax

BOOL EnumSystemCodePagesA(
  [in] CODEPAGE_ENUMPROCA lpCodePageEnumProc,
  [in] DWORD              dwFlags
);

Parameters

[in] lpCodePageEnumProc

Pointer to an application-defined callback function. The EnumSystemCodePages function enumerates code pages by making repeated calls to this callback function. For more information, see EnumCodePagesProc.

[in] dwFlags

Flag specifying the code pages to enumerate. This parameter can have one of the following values, which are mutually exclusive.

Value Meaning
CP_INSTALLED
Enumerate only installed code pages.
CP_SUPPORTED
Enumerate all supported code pages.

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_BADDB. The function could not access the data. This situation should not normally occur, and typically indicates a bad installation, a disk problem, or the like.
  • ERROR_INVALID_FLAGS. The values supplied for flags were not valid.
  • ERROR_INVALID_PARAMETER. Any of the parameter values was invalid.

Remarks

This function enumerates the code pages by passing code page identifiers, one at a time, to the specified application-defined callback function. This process continues until all installed or supported code page identifiers have been passed to the callback function, or the callback function returns FALSE.

When an application is using this function to determine an appropriate code page for saving data, it should use Unicode when possible. Other code pages are not as portable as Unicode between vendors or operating systems, due to different implementations of the associated standards.

Note

The winnls.h header defines EnumSystemCodePages as an alias that 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 is 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

EnumCodePagesProc

National Language Support

National Language Support Functions