Solved

Classes Interact

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Microsoft Edge 9 104
Excel file not created as expected 7 90
Problem to App source 6 89
How do I get Window Title of all opened process? 4 32
Preface This article introduces an authentication and authorization system for a website.  It is understood by the author and the project contributors that there is no such thing as a "one size fits all" system.  That being said, there is a certa…
What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
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…

685 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