Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. OnCmdMsg

OnCmdMsg

Scheduled Pinned Locked Moved C / C++ / MFC
question
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    grotesque
    wrote on last edited by
    #1

    Hi! I've been playing around with custom command routing a bit, and I've noticed that if you route a command message to a custom object, object.OnCmdMsg(...), and the function returns TRUE(saying it has handled the message and called the message handler), but I return FALSE instead (saying the message hasn't been handled), the command handler for the custom object is never called (even though it already should've been called(?)). I hope someone can give me an explanation on why the handler isn't being called, and that the description above isn't to messy :)

    R X 2 Replies Last reply
    0
    • G grotesque

      Hi! I've been playing around with custom command routing a bit, and I've noticed that if you route a command message to a custom object, object.OnCmdMsg(...), and the function returns TRUE(saying it has handled the message and called the message handler), but I return FALSE instead (saying the message hasn't been handled), the command handler for the custom object is never called (even though it already should've been called(?)). I hope someone can give me an explanation on why the handler isn't being called, and that the description above isn't to messy :)

      R Offline
      R Offline
      Ryan Binns
      wrote on last edited by
      #2

      This is the correct behaviour. MFC knows nothing about your custom object, even though you do. MFC checks to see if the current view handles the message. If it doesn't, it sends it to the current document. If the document doesn't handle it, it sends it to the current frame, the main frame (in an MDI application), and finally to the application if necessary. It never looks below the view.

      Ryan

      "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"

      1 Reply Last reply
      0
      • G grotesque

        Hi! I've been playing around with custom command routing a bit, and I've noticed that if you route a command message to a custom object, object.OnCmdMsg(...), and the function returns TRUE(saying it has handled the message and called the message handler), but I return FALSE instead (saying the message hasn't been handled), the command handler for the custom object is never called (even though it already should've been called(?)). I hope someone can give me an explanation on why the handler isn't being called, and that the description above isn't to messy :)

        X Offline
        X Offline
        Xakep
        wrote on last edited by
        #3

        You can find more information in Paul DiLascia article in Microsoft Systems Journal, 1995 (I don't remember month).

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups