Home

wParam

WPARAM is a Windows API type used to convey information in Windows messages. It is defined as an unsigned, pointer-sized integer (typedef UINT_PTR WPARAM) and matches the platform’s pointer size: 32 bits on 32‑bit Windows and 64 bits on 64‑bit Windows. Together with LPARAM, WPARAM forms part of the standard message parameter pair delivered to a window procedure.

Usage of WPARAM depends on the specific message being processed. In a typical window procedure, WPARAM is

Examples of common patterns include WM_COMMAND, where LOWORD(wParam) yields the control or menu item identifier and

There are helper macros to extract information from the parameters, such as LOWORD, HIWORD, and specialized

In short, WPARAM is a flexible, architecture-aware parameter in Windows messages, whose content is defined by

examined
in
conjunction
with
the
message
code
to
interpret
the
event.
Its
meaning
is
message-specific
and
documented
for
each
message.
In
many
cases
WPARAM
carries
identifiers,
handles,
or
bit
flags,
while
in
other
cases
it
may
simply
be
a
small
integer.
HIWORD(wParam)
provides
the
notification
code
when
the
command
originates
from
a
control
(for
menu
selections
HIWORD
is
zero).
For
keyboard
and
mouse
messages,
WPARAM
often
contains
modifier
or
state
flags;
for
example,
WM_KEYDOWN
uses
wParam
for
the
virtual-key
code,
while
certain
mouse
messages
use
wParam
to
convey
key-state
flags
and
coordinates
are
carried
in
LPARAM.
macros
like
GET_X_LPARAM
and
GET_Y_LPARAM
to
obtain
coordinates
from
LPARAM
for
mouse
messages.
Because
the
exact
interpretation
of
WPARAM
varies
by
message,
developers
should
consult
the
documentation
for
the
specific
message
being
handled
and
avoid
assuming
a
universal
meaning.
each
message
and
can
represent
identifiers,
handles,
flags,
or
small
values
as
appropriate.