Click to See Complete Forum and Search --> : routing command messages


Paul Burns
May 25th, 1999, 09:45 PM
this is probably not beginner stuff but i couldn't think of any other place it belongs.

Anyway, i have a dialog bar based on a derived CDialogBar class and a command handler in the MainFrame for a button on this dialog bar.

This all works ok, but now i want to also handle the same button click in the derived CDialogBar class to do some pre-processing before the main frame gets it. but it dont work! the command message seems to get consumed by the first handler the framework finds for it, which in this case is the CDialogBar derived class, and the main frame never gets the message.

so, what i'm trying to say is can i continue routing a command meesage through the rest of the framework even after i've handled it in a particular class?

David Langis
May 25th, 1999, 10:29 PM
Have you tried

ON_MESSAGE(WM_COMMAND, ID_MYCOMMAND, OnMyCommand)

instead of

ON_COMMAND(ID_MYCOMMAND, ...)

If OnMyCommand returns 0, the message should be sent back to the frame.

Paul Burns
May 25th, 1999, 11:42 PM
thanks! you got me pointed in the right direction and i found an even easier way using ON_COMMAND_EX. This allows the handler to return FALSE if you want to continue routing the message.