How to implement a dynamic menu in the VC 1. Generate a dynamic menu first define a menu class object: cMenu m_menumain; create a menu: createMenu (cMenu *) Create a normal menu item CreatePopUpMenu () Create a pop-up menu item 2. Using menu and app Program hooks can use setMenu (cMenu *) 3. Modify menu item Add and insert Using appendmenu () and INSERTMENU () Delete You can use DeleteMenu () ** 4. Message for dynamic menu items We can in oncmdmsg (uint NID, INT NCODE, VOID * Pextra, AFX_CMDHandlerInfo * HandlerInfo is handled. The NID in the parameter is the message ID number sent. For menus, it is the ID of the menu, if ncode = cn_command means the message emitted by the menu item. Below is an example Code: oncmdmsg (uint Nid, int ncode, void * pextra, afx_cmdhandlerinfo * handlerinfo) {wparam meneuid = getCurrentMessage () -> wparam; // Get the ID number IF (Menuid> = ID_MENU) //// // Check if the ID is dynamically established {if (Menuid == Nid && ncode == cn_command) // menu item is clicked {cstring strmenuname; // menu name getMenu () -> getmenustring (menuid, strmenuname, mf_string); / / According to StrMenuname, different processing}}} is the experience I am in writing the mate menu, you are welcome to make better solutions.