UnloadKeyboardLayout function (winuser.h)

Unloads an input locale identifier (formerly called a keyboard layout).


BOOL UnloadKeyboardLayout(
  [in] HKL hkl


[in] hkl

Type: HKL

The input locale identifier to be unloaded.

Return value

Type: BOOL

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. The function can fail for the following reasons:

  • An invalid input locale identifier was passed.
  • The input locale identifier was preloaded.
  • The input locale identifier is in use.
To get extended error information, call GetLastError.


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.

UnloadKeyboardLayout cannot unload the system default input locale identifier if it is the only keyboard layout loaded. You must first load another input locale identifier before unloading the default input locale identifier.


Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header winuser.h (include Windows.h)
Library User32.lib
DLL User32.dll

See also




Keyboard Input