Thread: Problems with view's message map in MFC

  1. #1
    Registered User
    Join Date
    Jan 2006
    Posts
    13

    Problems with view's message map in MFC

    I'm pretty new to MFC, and I've been working on a test program for aw hile. It started out as a "Multiple top-level documents" type program, but since I've used this program as my sandbox to test all the new things I've been learning about MFC it's turned into more of an SDI-like application (it only has one view and one document) but uses a CMultiDocTemplate object instead of a SingleDocTemplate object.

    Well, everything was working fine until today when I edited the code pretty heavily, mainly just adding lots of user events and event handlers that are handled in my app's frame window class. I compiled it and ran it, and for some reason all of my menu items whose events were handled in my view class (and which were unchanged and were working fine prior to this) were greyed out. I messed with some of the code, made sure all the ON_COMMAND message maps were correct and in place, and still nothing. I placed the same message handlers and ON_COMMAND maps into my frame window's class, and, lo and behold, they show up and work correctly in the menu when the program is run.

    I have checked all the super obvious things, like declaring DECLARE_MESSAGE_MAP() at the end of my view class' class declaration.

    Is there something stupid that I could have inadvertantly changed
    to have caused this? Could it be that I've somehow disabled messages being passed to the app's view or it's message map? It's been really frustrating and I have a lot of work i could be doing instead of banging my head against the wall for such a seemingly dumb problem, so I'd really appreciate any help you might be able to give me.
    Last edited by ubermensch; 05-25-2006 at 04:27 PM.

  2. #2
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    Need some code to determine the problem. I think I know what happened, but need some code to be sure.

    Post your **view.h and ***doc.h as well as their source files. You can upload them as text files via the attachment option on the board.

    Without those I have no way of knowing for sure what happened.

    With MFC it's normally something very simple making it look like something extremely complicated and deep.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. WIndows programming?
    By hostensteffa in forum Windows Programming
    Replies: 7
    Last Post: 06-07-2002, 08:52 PM
  2. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM
  3. Understanding The Future of MFC
    By kuphryn in forum Windows Programming
    Replies: 2
    Last Post: 04-15-2002, 09:08 PM
  4. Sending CChildView a Message :: MFC
    By kuphryn in forum Windows Programming
    Replies: 0
    Last Post: 04-06-2002, 03:00 PM
  5. Beginning MFC (Prosise) Part III - Now What? :: C++
    By kuphryn in forum C++ Programming
    Replies: 5
    Last Post: 03-03-2002, 06:58 PM