Handle the command message using a separate command class (for objects with a lot of command processing functions, as well as sh

zhaozj2021-02-08  203

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);

转载请注明原文地址:https://www.9cbs.com/read-1872.html

New Post(0)