1. Customizing messages in the header file of the corresponding class
such as: #define Wm_result wm_user+1
2. Define the message response function in the header file, note: The return value of this function must be the LRESULT parameter must be WPARAM and lparam type.
This is because afx_msg void OnMyMessage (WPARAM, LPARAM); It is possible to define this method in VC6, but it is strictly required after VS2005 and so on.
To be defined as such, such as: afx_msg LRESULT displayresult (WPARAM wparam,lparam LPARAM);
3. Associating messages and response functions in. cpp
such as: On_message (wm_result,cdemo4view::D isplayresult)
Implementing a message response function
LRESULT Cdemo4view::D isplayresult (WPARAM wparam,lparam LPARAM)
{
CString str;
Double time = (double) LParam;
Str. Format ("%d prime number is%d,%f", primenumbers,g_result,time);
MessageBox (str);
return 0;
}
After the above steps can be.