wParam and lParam

This question refers to the MSG structure. See below for the structure:
http://msdn.microsoft.com/en-us/library/ms644958%28VS.85%29.aspx

1
2
3
4
5
6
7
8
typedef struct tagMSG {
  HWND   hwnd;
  UINT   message;
  WPARAM wParam;
  LPARAM lParam;
  DWORD  time;
  POINT  pt;
} MSG, *PMSG, *LPMSG;



My question:
What's the difference between wParam and lParam? What do the 'w' and 'l' before param stand for?

I know they are additional messages and I think I know what it means by the general term "additional message". The heart of my question is their difference. It's probably not important from a pragmatic point of view since we don't usually need to deal directly with them, but I just want to know, for curiosity.

Thanks for any input.
Last edited on
I believe the names come from 16-bit development and no longer have meaning, but the names were kept. They both are 4 or 8 bytes in size in 32-bit and 64-bit development respectively. More than that I don't remember.
@ webJose:
Thank you very much for the reply! You are right.

I've also looked it up around and finally found it in a win32 book. I'll summarize it for other people in the future who run into the same confusion as I did:

In addition to webJose's comment: (assuming 32 bit machine)
wParam and lParam are used differently across messages. For example, WM_CLOSE doesn't use any and WM_COMMAND uses both in the way that:
wParam (32 bit, 2 words: high-bit word HIWORD and low bit word LOWORD) stores message in HIWORD and stores the control that sends the message in LOWORD;
lParam stores the window handle to the control which sent the message (of course, if message isn't from a control, lParam is NULL)


To sum up, they're usually hidden from a programmer who uses Win API. We don't typically deal with them directly.
To sum up, they're usually hidden from a programmer who uses Win API. We don't typically deal with them directly.



You are wrong, every Win Api program deals with lParam and wParam directly in main message loop.
Topic archived. No new replies allowed.