Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the definitions for LPARAM and WPARAM?

Tags:

c++

c#

windows

I know I'm being lazy here and I should trawl the header files for myself, but what are the actual types for LPARAM and WPARAM parameters? Are they pointers, or four byte ints? I'm doing some C# interop code and want to be sure I get it working on x64 systems.

like image 468
Mark Heath Avatar asked Mar 25 '10 12:03

Mark Heath


People also ask

What is Lparam and Wparam?

In the days of 16-bit Windows, a WPARAM was a 16-bit word, while LPARAM was a 32-bit long. These distinctions went away in Win32; they both became 32-bit values. According to this, LPARAM is defined as LONG_PTR , which in 64-bit Windows is a signed, 64-bit value.

What is the role of the parameters Wparam and Lparam?

Each message could carry with it two pieces of data, called WPARAM and LPARAM . The first one was a 16-bit value (“word”), so it was called W. The second one was a 32-bit value (“long”), so it was called L. You used the W parameter to pass things like handles and integers.

What is Lparam used for?

lParam - Specifies additional message information. The contents of this parameter depend on the value of the uMsg parameter.

What type is Lresult?

LRESULT is an integer value that your program returns to Windows. It contains your program's response to a particular message. The meaning of this value depends on the message code. CALLBACK is the calling convention for the function.


1 Answers

LPARAM is a typedef for LONG_PTR which is a long (signed 32-bit) on win32 and __int64 (signed 64-bit) on x86_64.

WPARAM is a typedef for UINT_PTR which is an unsigned int (unsigned 32-bit) on win32 and unsigned __int64 (unsigned 64-bit) on x86_64.

MSDN link

like image 101
CB Bailey Avatar answered Oct 02 '22 15:10

CB Bailey