Search code examples
c++winapiatlwtl

Confused by BEGIN_MSG_MAP and BEGIN_MSG_MAP_EX


I am tracing a bug and I suspect the root could be in the use of WTL macros. When sould I use *_EX and when normal macros. For BEGIN_MSG_MAP_EX there is a note in atlcrack.h

// Note about message maps with cracked handlers:
// For ATL 3.0, a message map using cracked handlers MUST use BEGIN_MSG_MAP_EX.
// For ATL 7.0 or higher, you can use BEGIN_MSG_MAP for CWindowImpl/CDialogImpl derived classes,
// but must use BEGIN_MSG_MAP_EX for classes that don't derive from CWindowImpl/CDialogImpl.

but how about the rest or the macros ? can I use both COMMAND_ID_HANDLER and COMMAND_ID_HANDLER_EX in the same BEGIN_MSG_MAP_EX for example ?


Solution

  • I recommend BEGIN_MSG_MAP_EX because it supports more handlers. It also supports the BEGIN_MSG_MAP handlers.