Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

WM_COMMAND Help

Status
Not open for further replies.

Valius

Programmer
Oct 20, 2000
174
US
Okay, I have another question. I have created two buttons on my little app...I can see that the WM_COMMAND message is issued each time I click on them. My questions is: How in the world can I tell which button was pressed when it sends the WM_COMMAND Message? My guess is that it is in the lParam parameter of my WndProc() function. But, how can i decipher it and how can I tell which "ID" my buttons have. Is there a way I can give them an "ID" when I create the buttons? Thanks for ya'll time and input!

Niky Williams
NTS Marketing, Inc.
 
try or LOWORD(lParam) or HIWORD(lParam) John Fill
1c.bmp


ivfmd@mail.md
 
I figgured it out...the problem was that I wasn't giving it a control ID...I didn't know how. I stumbled across the fact that you can assign a control ID when you Create the object through the HMENU parameter (5 hrs later). After I got this, I used GetDlgCtrlID to retreive the ID of the control when the WM_COMMAND was triggered. This works just fine. I do appreciate your input though! I do have a quick question...The LOWORD(wParam) holds the control ID...I also noticed that if you just use wParam, it holds the control ID...Is it "dangerous" to JUST use wParam instead of LOWORD(wParam) or is it okay to use them either way?

Niky Williams
NTS Marketing, Inc.
 
to use HIWORD/LOWORD is a bad way of different kind of compatibilies, but is an accepted method. John Fill
1c.bmp


ivfmd@mail.md
 
Cool, thank you for your knowledge and opinion!

Niky Williams
NTS Marketing, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top