Solved

Classes Interact

Posted on 2004-09-10
3
195 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 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

Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

Question has a verified solution.

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

Shoutout to Emily Plummer (http://www.experts-exchange.com/members/eplummer26.html) for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

728 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