Each work you have to do for a Windows application is almost messaging, and Windows system messages are divided into common Windows messages, control notification messages, and commands. However, sometimes we need to define your own news to notify the program what happened, this is the user-defined message. ClassWizard does not provide the ability to increase user-defined messages, so use user-defined messages must be handled manually. The ClassWizard can then process your custom message like processing other messages. The specific practice is detailed as follows: The first step: define the message. When a message is actually developing a Windows 95 application, Microsoft recommends user-defined messages at least WM_USER 100 because many new controls should also use WM_USER messages. Step 2: Implement the message processing function. This function uses WPRAM and LPARAM parameters and returns lpeSult. LpeSult CMAINFRAME :: ONMYMESSAGE (WPARAM WPARAM, LPARAM LPARAM) {// Todo: Handle User Custom Message AFXMessageBox ("Process User Custom Message"); Return 0;} Step 3: Description in the AFX_MSG block of the class header file message handler: class CMainFrame: public CMDIFrameWnd {... // general message mapping function protected: // {{aFX_MSG (CMainFrame) afx_msg int OnCreate (LPCREATESTRUCT lpCreateStruct); afx_msg void OnTimer (UINT nIDEvent); afx_msg LRESULT OnMyMessage (WPARAM WPARAM, LPARAM LPARAM; //}} AFX_MSG DECLARE_MESSAGE_MAP ()} Step 4: In the user class message block, use the ON_MESSAGE macro to map the message to the message processing function. BEGIN_MESSAGE_MAP (CMainFrame, CMDIFrameWnd) // {{AFX_MSG_MAP (CMainFrame) ON_WM_CREATE () ON_WM_TIMER () ON_MESSAGE (WM_MY_MESSAGE, OnMyMessage) //}} AFX_MSG_MAPEND_MESSAGE_MAP () Thus, a user-defined message can be used, and if the user needs a whole The unique message can call the SDK function registerWindowMessage and use the on_register_message macro to replace the ON_MESSAGE macro, the rest of the steps.