afx_msg term in message handler functions

2019-08-21 01:14发布

问题:

Why afx_msg is used in message handler function declarations?

回答1:

I think it was used by earlier Microsoft Visual Studio IDEs to distinguish message handlers from other member functions. These days the IDE is more clever and does not need it. At least I do not remember any bad effect from not using it.



回答2:

afx_msg is defined like this in the MFC headers:

#define afx_msg

so not using it it does not harm at all.

But it's still used by the Visual Studio 2010 IDE (not sure for Visual Studio 2012) to distinguish message handlers from other member functions as the previous answer did suggest.