LRESULT
AFX_MSG
afx_msg 是一個宏 標識是消息映射函數,增加可讀性。
在 MSDN裏是這樣定義的:
AFX_MSG
remarks
ClassWizard and AppWizard insert specially formatted comment delimiters in your
source code files to mark the places in your files that ClassWizard can write to.
AFX_MSG is used to mark the beginning and end of ClassWizard entries in your
n="left"> header file (.H) related to message maps:
//{{AFX_MSG(classname)
...
//}}AFX_MSG
在CSDN 中也有人這樣解釋:
afx_msg是給MFC classwiard作的標記,表示這個.cpp文件中classwiard應該插入代碼的地方。 如果把{{//afx_msg ......等類似的符號刪了,classwizard 就會報錯。
也就是說,如果你把那些東西刪了,你就用不了classwizard,而只能手工輸入代碼了
afx_msg 什麼都沒定義,是爲以後擴充保留的。
它的定義如下:(具體在哪個文件裏,我忘記了)
#define afx_msg
可以看出來它實際上是一個空定義!
這些消息處理函數的說明一般都有“afx_msg”的前綴,用於把處理函數與其他的窗口成員函數區分開來,這些函數都是通過消息映射實現的。比如,消息 WM_CHAR 的處理函數在 CWnd 中聲明成: