Solved

sending msgs to a ccmdtarget class..

Posted on 1998-06-16
5
610 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

763 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

16 Experts available now in Live!

Get 1:1 Help Now