I'm a new in WTL.
One of the classes of a project I'm working on is WTL GUI class. Its message map contains a record:
COMMAND_CODE_HANDLER(0, OnMenuClick)
OnMenuClick
handles all WM_COMMAND
's are sent after menu click. Is there way to set another command handlers for some certain messages, while OnMenuClick
processes all other ones?
I tried this:
COMMAND_ID_HANDLER(ID_START_TASK, OnStartTask);
COMMAND_CODE_HANDLER(0, OnMenuClick)
It works, OnStartTask
processes ID_START_TASK
commands, but it depends on declaration order. If i change the strings declaration order, OnMenuClick
processes ID_START_TASK
commands.
I use VS 2008 + WTL 8.0
From COMMAND_HANDLER:
The message map sets bHandled to TRUE before CommandHandler is called. If CommandHandler does not fully handle the message, it should set bHandled to FALSE to indicate the message needs further processing.
WTL calls handlers as long as none of them signalled that they handled the message. If the handler doesn't explicitly set bHandled to FALSE, WTL will not pass the message to the next handler.