View Full Version: WM_COMMAND

C++ Learning Community > win32 api C++ programming > WM_COMMAND


Title: WM_COMMAND
Description: What is put in WPARAM and LPARAM?


dr voodoo - June 30, 2003 09:01 PM (GMT)
If you have a menu bar you give each item a unic ID and for buttons it's the same.
If you push one of them a WM_COMMAND message will be send to the parent window and LPARAM will contain that ID. But if I also have a LISTBOX with the style LBS_NOTIFY a WM_COMMAND message will also be send to the parent window and (if I have understood correctly) LPARAM will contain the ID of the item which has been pushed in that listbox.

But here is my problem in a LISTBOX you can not define the ID yourself. The ID will be the place in that list. If a have 2 LISTBOXs how can I know from which one the WM_COMMAND message came? :blink:
So I thought that perhaps WPARAM could contain some information about that but I have no idea what it containes. And while I'm asking does anyone know what type LPARAM is? I got an error when comparing it to an int and don't know if it was because LPARAM isn't an integer or if my code was wrong.

EDIT:Solved
LOWORD(wParam) is the ID.
(HWND) lParam is the handler of the control.




* Hosted for free by InvisionFree