Solved

sending msgs to a ccmdtarget class..

Posted on 1998-06-16
5
617 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
[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
  • 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

Enroll in June's Course of the Month

June's Course of the Month is now available! Every 10 seconds, a consumer gets hit with ransomware. Refresh your knowledge of ransomware best practices by enrolling in this month's complimentary course for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

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

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
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.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

705 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