1.定義消息:
在stdafx.h 中加入如下代碼:
#ifndef WM_NOISE
#define WM_NOISE WM_USER+2
#endif
2、
在 **Dlg.h 文件中加入:
afx_msg LRESULT 消息響應函數;
3、
在**Dlg.cpp 文件中加入消息的注冊:
ON_MESSAGE(WM_NOISE, &**Dlg:: 消息響應函數)
4、
實現消息響應函數
在**Dlg.cpp中加入消息響應函數的實現部分,代碼如下:
void **Dlg::函數名( ,)
{
}