Windows apps
Collapse the table of content
Expand the table of content
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

EnumSystemCodePages function

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


BOOL EnumSystemCodePages(
  _In_ CODEPAGE_ENUMPROC lpCodePageEnumProc,
  _In_ DWORD             dwFlags


lpCodePageEnumProc [in]

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.

dwFlags [in]

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


Enumerate only installed code pages.


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.


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.


Minimum supported client

Windows 2000 Professional [desktop apps | UWP apps]

Minimum supported server

Windows 2000 Server [desktop apps | UWP apps]


Winnls.h (include Windows.h)





Unicode and ANSI names

EnumSystemCodePagesW (Unicode) and EnumSystemCodePagesA (ANSI)

See also

National Language Support
National Language Support Functions



© 2018 Microsoft