The following is a tutorial on how to add intelligent menus to your application. This tutorial assumes that you have already created an application that uses Office style toolbars and menus. For a tutorial on how to create an application that uses Office style toolbars and menus, click here.
Create a simple MDI application using the MFC AppWizard:
static UINT uHideCmds[] =
{
ID_FILE_PRINT, ID_FILE_PRINT_PREVIEW, ID_WINDOW_CASCADE
};
// Hide array of commands pCommandBars->HideCommands(uHideCmds, _countof(uHideCmds)); // Set "Always Show Full Menus" option to the FALSE XTP_COMMANDBARS_OPTIONS* pOptions = pCommandBars-> GetCommandBarsOptions(); pOptions->bAlwaysShowFullMenus = FALSE;
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { ... // Load the previous state for toolbars and menus. LoadCommandBars(_T("CommandBars")); return 0; }
void CMainFrame::OnClose() { // Save the current state for toolbars and menus. SaveCommandBars(_T("CommandBars")); CMDIFrameWnd::OnClose(); }
User Comments
No comments yet, sign in to comment.