What is Wparam and Lparam?
In the days of 16-bit Windows, a WPARAM was a 16-bit word, while LPARAM was a 32-bit long. According to this, LPARAM is defined as LONG_PTR , which in 64-bit Windows is a signed, 64-bit value. WPARAM is defined as UINT_PTR , which in 64-bit Windows is an unsigned, 64-bit value.
What is the role of the parameters Wparam and Lparam?
wParam – Specifies additional message information. The contents of this parameter depend on the value of the uMsg parameter. lParam – Specifies additional message information.
How do you use Wparam and Lparam?
It is helpful to understand the origin of the terms. If you look at the design of window messages, you will see that if the message takes a pointer, the pointer is usually passed in the LPARAM , whereas if the message takes a handle or an integer, then it is passed in the WPARAM .
What is Wm_close?
WM_CLOSE is sent to the window when it is being closed – when its “X” button is clicked, or “Close” is chosen from the window’s menu, or Alt-F4 is pressed while the window has focus, etc. If you catch this message, this is your decision how to treat it – ignore it, or really close the window.
Where do the names wParam and lParam come from?
Given a standard windows procedure function: Where do the names wParam and lParam come from and what the history behind them? Under Win16, the types of these parameters were WORD and LONG. Back in the dark ages of Windows 3.0 these names were already well established.
What does the W stand for in wParam?
When Windows was converted to 32-bit, the WPARAM parameter grew to a 32-bit value as well. So even though the “W” stands for “word”, it isn’t a word any more. (And in 64-bit Windows, both parameters are 64-bit values!) It is helpful to understand the origin of the terms.
What do wParam and lParam mean in Win32?
For example, the documentation for the WM_SIZE message states that: wParam is a flag that indicates whether the window was minimized, maximized, or resized. lParam contains the new width and height of the window as 16-bit values packed into one 32- or 64-bit number. You will need to perform some bit-shifting to get these values.
What happens to wParam, lParam, and lresult?
The WPARAM is zero-extended, while LPARAM and LRESULT are sign-extended. If you remember that WPARAM used to be a WORD and LPARAM and LRESULT used to be LONG , then this follows from the fact that WORD is an unsigned type (therefore zero-extended) and LONG is a signed type (therefore sign-extended).