Solved

button id

Posted on 1998-04-13
2
158 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 30 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

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…
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

746 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now