[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Classes Interact

Posted on 2004-09-10
3
Medium Priority
?
201 Views
Last Modified: 2013-11-20
Suppose that I have a COleControl that open a CDialog, how can I do to interact with the parent class?? Via messages??

Thanks.
0
Comment
Question by:DAE
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 13

Accepted Solution

by:
SteH earned 375 total points
ID: 12024436
Messages would be the cleanest solution.

In principle you can call GetParent () to get a CWnd* pointer of the parent class. But most likely you won't be able to use this without casting it to the actual type of the parent. That way the dialog class needs to know all details about the parent class which should be avoided for OO design.

With messages you only need to know the message number and what to specify as parameter. The parent class will handle them accordingly. You still need a pointer of the parent class but this time the CWnd* is sufficient.
0
 
LVL 45

Expert Comment

by:AndyAinscow
ID: 12024448
Your question is very general but the answer is likely to be yes.

Messages are a general way of communicating without relying on knowing anything else about the windows involved.
If you are worried about using a message that is already in use then look at RegisterWindowsMessage in help.  This gives a unique message for an identifier, other windows will get the same ID for the same identifier.
0
 

Author Comment

by:DAE
ID: 12037218
Thaks SteH and Andy
0

Featured Post

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

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

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
Suggested Courses

656 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