Solved

sending msgs to a ccmdtarget class..

Posted on 1998-06-16
5
614 Views
Last Modified: 2013-11-20
I am into the design of a digital simulator. I plan to send messages for all auspicious events occuring in the
circuit. Is it necessary that i should derive my classes from CWnd inorder to recieve a msg? If i derive from CCmdTarget, can i by anyway send msgs to it? Suppose if i am having a hidden window and if i send msgs to that,. can i route  that msgs through my set of CCmdtarget derived classes??
0
Comment
Question by:vivi052098
  • 2
  • 2
5 Comments
 
LVL 3

Accepted Solution

by:
Norbert earned 50 total points
ID: 1317992
If you receive a message you can do what you want the only thing you have to do is to figure out which CCmdTarget derived class you have to call but I think thet depends on the message and therefore that should be no problem
0
 
LVL 3

Expert Comment

by:Norbert
ID: 1317993
CCmdTarget has no window and therefore no message queue
but if you have a window that receives the messages there is no problem to reshedule them to the CCmdTarget Derived classes
The only thing the class that encapsulate the window functionality has to know is where the derived classes are

0
 
LVL 3

Expert Comment

by:tma050898
ID: 1317994
It doesn't sound like a CCmdTarget class is what you want. CCmdTarget derived classes are used in scenarios where you want a command routed to your class. These commands are usually originated by the MFC framework. For example, in our application we have two "tools": a database editor and a forms editor. Each tool is made up of several views, dialog bars and a document. I wanted each tool to handle all the commands for its views, dialog bars and document. Therefore, both the database editor and the forms editor are CCmdTarget derived and are "inserted" into the "command routing stream" via the CMainFrame::OnCmdMsg member function.

However, in your situation where you are originating the message and have control of how and where it is sent, it would be simpler to just send the message to a CWnd derived object instead.

Tom

0
 

Author Comment

by:vivi052098
ID: 1317995
Tom,
     I can very well derive all my classes from CWnd but the point is that if i could derive from CCmdTarget which is somewhere higher in the heirarchy, i can reduce the memory overhead. I may have 100's of classes conected in my project and hence this problem.
    Well, i see u'r point and please tell me if i can keep one window hidden and route all messages through that...
0
 
LVL 3

Expert Comment

by:tma050898
ID: 1317996
Before I answer that, I want to make sure that we're talking abou the same thing. When you say "route all messages" through that, do you mean can YOU send messages directly to the hidden window or do you mean that you want all messages normally handled by framework to be routed to that window instead of somewhere else???
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Turn a spreadsheet into a vba executable. 2 78
Complete beginner needs help making a cron job 9 109
twoTwo  challenge 35 93
Annoying "thing" blocks my view 4 81
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Delivering innovative fully-managed cloud services for mission-critical applications requires expertise in multiple areas plus vision and commitment. Meet a few of the people behind the quality services of Concerto.

911 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

19 Experts available now in Live!

Get 1:1 Help Now