Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

button id

Posted on 1998-04-13
2
Medium Priority
?
171 Views
Last Modified: 2010-04-10
I am writing a window application, in C++ from scratch.   In my UI, I have a pushbutton....when
pushed, I pull off the message and switch on the type of message, i.e. LBUTTONDN.  My
question is this:  Does this pushbutton have an  ID?  If so, how can I get it?  I am from a
MOTIF background so any comparisons would help....

thanks in advance
0
Comment
Question by:smithc
2 Comments
 
LVL 4

Accepted Solution

by:
piano_boxer earned 60 total points
ID: 1184237
When you pushes the button it will send a WM_COMMAND message to its parent (owner). When you receive this message you can get the id of the control which triggered the WM_COMMAND message by doing this:

WORD wId = LOWORD(wParam);
0
 
LVL 11

Expert Comment

by:alexo
ID: 1184238
If you create your dialog using a resource editor, the control's ID is defined in the include file (usually resource.h).

Also, look at the functions GetDlgCtrlID() and GetDlgItem().
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
Suggested Courses

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question