?
Solved

Problem with user control

Posted on 2005-04-06
3
Medium Priority
?
198 Views
Last Modified: 2010-04-24
Hello.

I have created a library that has a user control.
The user control has some windows control such as button or linklabel.
I use this library as "my user controls" in another projects.

my question is how I can find out that specific button or linklabel
clicked when I want to write their handlers in another project (not the same project that I design the user control) ?

Thank you.
0
Comment
Question by:mr60
  • 2
3 Comments
 
LVL 3

Expert Comment

by:mactep13
ID: 13721823
Trap the event handlers using the message map. The controls you created should have IDs assigned to them in the resource.h file. You must have done so when created the controls. Now, trap the events in the map such as:
ON_BN_CLICKED(ID_OF_CONTROL, Handler_Func)
and so on...
0
 
LVL 1

Author Comment

by:mr60
ID: 13731898
mactep13

when users use library in another projects, they don't have Handler_Func; they should define their custom handlers and any one don't know their name previously.
0
 
LVL 3

Accepted Solution

by:
mactep13 earned 500 total points
ID: 13732201
The name of the function is not important. What is important is that they use the same ID for the control and the proper event macro. So, for button clicked they would use
ON_BN_CLICKED(ID_OF_CONTROL, Their_Handler Func)
They will define their function based on the type of event they are trying to catch.
For Button Clicked, they would prototype it to be something like:
afx_msg void OnButtonClick(void);
Once they write it and the event fires that matches the ID of the control, their event handler func will be invoked.

Does this make sense?
mactep.
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

The following diagram presents a diamond class hierarchy: As depicted, diamond inheritance denotes when two classes (e.g., CDerived1 and CDerived2), separately extending a common base class (e.g., CBase), are sub classed simultaneously by a fourt…
In Easy String Encryption Using CryptoAPI in C++ (http://www.experts-exchange.com/viewArticle.jsp?aid=1193) I described how to encrypt text and recommended that the encrypted text be stored as a series of hexadecimal digits -- because cyphertext may…
Screencast - Getting to Know the Pipeline
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…

809 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