Home

MAKELANGID

MAKELANGID is a macro used in the Windows API to construct a language identifier (LANGID) by combining a primary language ID with a sublanguage ID. It is defined in the Windows header WinNT.h and is commonly used when specifying the language or locale for Windows functions and applications.

Definition and bit layout

The macro expands to a bitwise operation that places the primary language ID into the upper bits

Usage

MAKELANGID is used wherever a LANGID is required, such as setting thread or process locale, formatting localized

Examples and context

A typical usage is MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US) to represent English as used in the United States. The

See also

Related concepts include LANGID, LCID, MAKELCID, PRIMARYLANGID, and SUBLANGID. MAKELANGID is a compile-time macro, not a

and
the
sublanguage
ID
into
the
lower
bits
of
a
16-bit
LANGID.
A
typical
form
is:
#define
MAKELANGID(primary,
sub)
((((USHORT)(primary))
<<
10)
|
(USHORT)(sub)).
In
this
scheme,
the
high
bits
encode
the
primary
language,
while
the
low
bits
encode
the
sublanguage.
The
resulting
LANGID
is
a
16-bit
value
used
by
various
Windows
APIs
to
identify
language
and
regional
variation.
strings,
or
querying
language-specific
resources.
It
is
common
to
combine
predefined
constants
such
as
LANG_*
(primary
language
identifiers)
and
SUBLANG_*
(sublanguage
identifiers)
to
form
a
specific
language
tag.
Macros
like
PRIMARYLANGID
and
SUBLANGID
can
be
used
to
extract
the
respective
components
from
an
existing
LANGID.
macro
is
part
of
the
broader
Windows
locale
and
language
framework,
which
also
includes
LCIDs
and
related
macros
such
as
MAKELCID
for
constructing
locale
identifiers.
function,
and
is
specific
to
Windows
development.