Solved

sending msgs to a ccmdtarget class..

Posted on 1998-06-16
5
615 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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…
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.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

773 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