Objective Toolkit : Chapter 7 Menu Bars : Customizing the Display of Menu Pop-ups
Customizing the Display of Menu Pop-ups
When a menu pop-up is displayed, a registered message WM_SECGETMENU is sent to the SECFrameWnd/SECMDIFrameWnd. The WPARAM parameter specifies the ID of the menu containing the pop-up. The LPARAM parameter specifies the index of the pop-up within that menu. The message handler needs to return the HMENU of the pop-up menu to be displayed.
The default handler for this message retrieves the pop-up menu by searching the CMultiDocTemplate list for the correct menu ID. If the list does not contain the menu ID, the handler searches the frame menu resource. By providing your own handler for this message, you can customize the returned HMENU, the only restriction is that the HMENU handle must persist after this function returns.
Note that both SECFrameWnd and SECMDIFrameWnd have member variables (m_hMenuFrame and m_nIDMenuResource) that contain the handle of the frame window's menu and its ID (when menu bar support is enabled).