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.