Solved

Classes Interact

Posted on 2004-09-10
3
189 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
3 Comments
 
LVL 13

Accepted Solution

by:
SteH earned 125 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 44

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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
conditional code and condition difference 9 65
How to run a side-by-side staging website 16 57
noX challenge 17 76
wordappend challenge 8 84
There are two main kinds of selectors in CSS: One is base selector like h1, h2, body, table or any existing HTML tags.  For instance, the following rule sets all paragraphs (<p> elements) to red: (CODE) CSS also allows us to define our own custom …
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
The viewer will learn how to count occurrences of each item in an array.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

707 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

11 Experts available now in Live!

Get 1:1 Help Now