WPARAM and LPARAM ?
-
This may sound silly. Is there any specific guideline as to what goes into WPARAM and LPARAM or does it depend on the event that uses it. I sometimes get confused with this. :confused:. And of course both are 32 bit.
Jesus Loves:rose:
--Owner Drawn:rose: --Nothing special --Defeat is temporary but surrender is permanent --Never say quits --Jesus is Lord:rose:
-
This may sound silly. Is there any specific guideline as to what goes into WPARAM and LPARAM or does it depend on the event that uses it. I sometimes get confused with this. :confused:. And of course both are 32 bit.
Jesus Loves:rose:
--Owner Drawn:rose: --Nothing special --Defeat is temporary but surrender is permanent --Never say quits --Jesus is Lord:rose:
in the header file it says,
/* Types use for passing & returning polymorphic values */ typedef UINT WPARAM; typedef LONG LPARAM; typedef LONG LRESULT;
so WPARAM can be anything as long as you dont want to pass a negative values, LPARAM can take negative values, Also both are used for polymorphic values, so anything from number of trees to pointers can go there ;) I generally use LPARAM for pointers only.
-Prakash
-
This may sound silly. Is there any specific guideline as to what goes into WPARAM and LPARAM or does it depend on the event that uses it. I sometimes get confused with this. :confused:. And of course both are 32 bit.
Jesus Loves:rose:
--Owner Drawn:rose: --Nothing special --Defeat is temporary but surrender is permanent --Never say quits --Jesus is Lord:rose:
The guideline is indeed tied to the event. That's the point, a generate purpose param that can hold whatever the event wants to pass. Christian Graus - Microsoft MVP - C++
-
This may sound silly. Is there any specific guideline as to what goes into WPARAM and LPARAM or does it depend on the event that uses it. I sometimes get confused with this. :confused:. And of course both are 32 bit.
Jesus Loves:rose:
--Owner Drawn:rose: --Nothing special --Defeat is temporary but surrender is permanent --Never say quits --Jesus is Lord:rose:
In LPARAM or in WPARAM.
Jesus Loves:rose:
--Owner Drawn:rose: --Nothing special --Defeat is temporary but surrender is permanent --Never say quits --Jesus is Lord:rose:
-
In LPARAM or in WPARAM.
Jesus Loves:rose:
--Owner Drawn:rose: --Nothing special --Defeat is temporary but surrender is permanent --Never say quits --Jesus is Lord:rose:
HWND is a handle, so you dont know what value it would hold, so i would put that on LPARAM.
-Prakash
-
This may sound silly. Is there any specific guideline as to what goes into WPARAM and LPARAM or does it depend on the event that uses it. I sometimes get confused with this. :confused:. And of course both are 32 bit.
Jesus Loves:rose:
--Owner Drawn:rose: --Nothing special --Defeat is temporary but surrender is permanent --Never say quits --Jesus is Lord:rose:
I am not sure if this still hold true, maybe someone else knows, but the WPARAM used to get trunated to the lower 16 bits when it passed through some message filters. Therefore, I am careful, still, to only pass 16-bit or less values in WPARAM. LPARAM never had any such issues.
-
I am not sure if this still hold true, maybe someone else knows, but the WPARAM used to get trunated to the lower 16 bits when it passed through some message filters. Therefore, I am careful, still, to only pass 16-bit or less values in WPARAM. LPARAM never had any such issues.
Blake Miller wrote:
but the WPARAM used to get trunated to the lower 16 bits when it passed through some message filters
Can you suggest message filters. I would like to know. So in your opinion what should I do for consistency sake. A few guidelines from you would be helpful. Or maybe what do you do normally.
Jesus Loves:rose:
--Owner Drawn:rose: --Nothing special --Defeat is temporary but surrender is permanent --Never say quits --Jesus is Lord:rose:
-
Blake Miller wrote:
but the WPARAM used to get trunated to the lower 16 bits when it passed through some message filters
Can you suggest message filters. I would like to know. So in your opinion what should I do for consistency sake. A few guidelines from you would be helpful. Or maybe what do you do normally.
Jesus Loves:rose:
--Owner Drawn:rose: --Nothing special --Defeat is temporary but surrender is permanent --Never say quits --Jesus is Lord:rose:
I am not sure which message filters would truncate WPARAM to 16 bits. However, that is WHY it was originally called WPARAM - because it was limited to being a WORD (16-bits). I limit WPARAM in my work to 16 bits. I use LPARAM full 32 bits. Usually I do not try to pass pointers or much data through the messages. I pass messages as notifications only between 'subsystems' and rely upon data retrieval function calls to be made to collect the data itself. Some programmers rely upon SendMessage to pass pointers to data via the message queue between subsystems, but that ends up being more trouble to synchyronize with the sending and receiving windows' other activities and other events occuring in a multithreaded envionment. Sure I guess it works okay if the application has a signle thread, but that is not the type of code I am typically writing anyway.