3

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 ?

Community
  • 1
  • 1
cprogrammer
  • 5,503
  • 3
  • 36
  • 56

2 Answers2

1

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

Cosmin
  • 21,216
  • 5
  • 45
  • 60
0

It will be safer if you add this to your main header file (probably stdafx.h)

#undef BEGIN_MSG_MAP
#define BEGIN_MSG_MAP BEGIN_MSG_MAP_EX

So now code that is using BEGIN_MSG_MAP will be translated to BEGIN_MSG_MAP_EX which is better in every aspect.

NeverHopeless
  • 11,077
  • 4
  • 35
  • 56
user603022
  • 11
  • 1