Home

LPARAM

lParam is a parameter used in Windows messages to convey additional information to a window procedure. It is the second parameter, along with wParam, passed to the window procedure (WndProc) and its interpretation is defined by the specific message. The type of lParam is LPARAM, which is a signed, pointer-sized long: 32 bits on 32-bit builds and 64 bits on 64-bit builds.

The meaning of lParam varies by message. For some messages it carries small integer data or flags,

Because lParam is architecture-dependent, code that interprets it should use the documented interpretation for each message

Security and correctness considerations include the fact that data passed in lParam may be a pointer to

In summary, lParam provides message-specific information to window procedures, with its type and interpretation determined by

while
for
others
it
holds
a
pointer
to
a
data
structure.
A
common
example
is
mouse
input
messages
such
as
WM_MOUSEMOVE,
where
the
x
and
y
coordinates
are
packed
into
the
low
and
high
words
of
lParam.
Macros
such
as
GET_X_LPARAM
and
GET_Y_LPARAM
are
used
to
extract
the
signed
16-bit
coordinates
from
lParam.
For
other
messages,
lParam
is
a
pointer
to
a
structure,
for
instance
lParam
may
point
to
a
COPYDATASTRUCT
in
WM_COPYDATA
or
to
an
NMHDR
structure
in
WM_NOTIFY,
in
which
case
you
cast
lParam
to
the
appropriate
pointer
type.
and
appropriate
casting
or
macros.
It
is
not
universal
data;
its
content
is
defined
by
the
message’s
documentation.
memory
in
the
sending
process.
When
messages
cross
process
boundaries,
pointers
in
lParam
are
invalid
in
the
receiving
process,
so
cross-process
communication
should
avoid
passing
raw
pointers
and
instead
use
safe
IPC
methods
such
as
CopyData,
shared
memory,
or
other
mechanisms.
the
individual
Windows
message
being
processed.