The main window of the application usually has a number of command messages. This will make the file very large and it is not easy to find. To clearly, the object can be abstracted to the processing of the command message, making a (one here, but can be divided into multiple) classes.
This method is suitable for objects with a lot of command processing functions, as well as shared command processing functions.
BOOL CWorkBenchDlg :: OnCmdMsg (UINT nID, int nCode, void * pExtra, AFX_CMDHANDLERINFO * pHandlerInfo) {// TODO: Add your specialized code here and / or call the base class if (m_CccXCommandHandler.OnCmdMsg (nID, nCode, pExtra, pHandlerInfo )) Return True; Return Cappbar :: ONCMDMSG (NID, NCODE, PEXTRA, PHANDLERINFO);