GetKeyboardLayoutName function

Retrieves the name of the active input locale identifier (formerly called the keyboard layout) for the system.

Syntax


BOOL WINAPI GetKeyboardLayoutName(
  _Out_  LPTSTR pwszKLID
);

Parameters

pwszKLID [out]

Type: LPTSTR

The buffer (of at least KL_NAMELENGTH characters in length) that receives the name of the input locale identifier, including the terminating null character. This will be a copy of the string provided to the LoadKeyboardLayout function, unless layout substitution took place.

Return value

Type: BOOL

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

The input locale identifier is a broader concept than a keyboard layout, since it can also encompass a speech-to-text converter, an Input Method Editor (IME), or any other form of input.

Beginning in Windows 8: The preferred method to retrieve the language associated with the current keyboard layout or input method is a call to Windows.Globalization.Language.CurrentInputMethodLanguageTag. If your app passes language tags from CurrentInputMethodLanguageTag to any National Language Support functions, it must first convert the tags by calling ResolveLocaleName.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Winuser.h (include Windows.h)

Library

User32.lib

DLL

User32.dll

Unicode and ANSI names

GetKeyboardLayoutNameW (Unicode) and GetKeyboardLayoutNameA (ANSI)

See also

Reference
ActivateKeyboardLayout
LoadKeyboardLayout
UnloadKeyboardLayout
Conceptual
Keyboard Input

 

 

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.