National Language Support F ...


GetACP Function

Retrieves the current Windows ANSI code page identifier for the operating system.

Caution  The ANSI API functions, for example, the ANSI version of TextOut, implicitly use GetACP to translate text to or from Unicode. For the Multilingual User Interface (MUI) edition of Windows, the system ACP might not cover all code points in the user's selected logon language identifier. For compatibility with this edition, your application should avoid calls that depend on GetACP either implicitly or explicitly, as this function can cause some locales to display text as question marks. Instead, the application should use the Unicode API functions directly, for example, the Unicode version of TextOut.

Syntax

UINT GetACP(void);

Parameters

This function has no parameters.

Return Value

Returns the current Windows ANSI code page (ACP) identifier for the operating system. See Code Page Identifiers for a list of identifiers for Windows ANSI code pages and other code pages.

Remarks

The ANSI code pages can be different on different computers, or can be changed for a single computer, leading to data corruption. For the most consistent results, applications should use UTF-8 or UTF-16 when possible.

Requirements

Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinnls.h (include Windows.h)
LibraryKernel32.lib
DLLKernel32.dll

See Also

National Language Support
National Language Support Functions
Code Page Identifiers
GetCPInfo
GetOEMCP

Send comments about this topic to Microsoft

Build date: 10/9/2009

Tags :


Community Content

dmex
vb.net syntax
<DllImport("kernel32.dll")> _
Public Shared Function GetACP() As Integer End Function
Tags : vb.net syntax

dmex
C# syntax
[DllImport("kernel32.dll")]
public static extern int GetACP();
Tags : c# syntax

Thomas Lee
Alternative to using unmanaged code

As an alternative to using this unmanaged API, use the managed System.TextInfo class, and the ANSICodePage property.

For more information on this property, see: http://msdn.microsoft.com/en-us/library/system.globalization.textinfo.ansicodepage(VS.71).aspx


Page view tracker