Advertisement

lparam and wparam?

Started by April 26, 2002 09:06 PM
12 comments, last by Wachar 22 years, 10 months ago
What''s the difference between lparam and wparam? ---------- Take it to the Xtreme! ----------
Wachar's Eternity <-<-<-<-<- Me own site!
They''re different parameters.

Advertisement
I know that, but what do they DO?

----------
Take it to the Xtreme!
----------
Wachar's Eternity <-<-<-<-<- Me own site!
It varies between messages. Read your Win32 API documentation.
They''re used to relay additional information to a window when a message is passed to it. For example, when you click your left mouse button, a message is generated and sent to the window with the current focus. lparam and wparam are filled with information about the mouse (it''s coordiates, button state, etc..). When you resize a window, the new width and height are relayed thru lparam and wparam. I don''t know the exact difference (I think they''re both 32-bit). I remember reading somewhere that there traditionally was a difference, but I''m not sure what.

Hope this helps.
There is no difference between the two anymore, they are both now 32-bit values. In Windows 3.1, WPARAM was a 16-bit value.
Advertisement
So they''re used for mouse tracking?

----------
Take it to the Xtreme!
----------
Wachar's Eternity <-<-<-<-<- Me own site!
Only in that circumstance.
THey are additional parameters used for passing extra information to functions, as determined by that message.
In and of themselves, they mean nothing.
But you have the ability to use them for anything that needs to be passed around between windows.
In use,
the are uaualy casted to the aprotiate type.
So if the message had to do somthing with a string
then to use the sent paramiter, you would have to cast lparam or wparam:
TCHAR* strFoob = (TCHAR*)lParam;

[ my engine ][ my game ][ my email ]
SPAM
Rate me up.
But, how do yo uknow which one to use in function parameters?

----------
Take it to the Xtreme!
----------
Wachar's Eternity <-<-<-<-<- Me own site!

This topic is closed to new replies.

Advertisement