BOOL CMainMDIFrame::OnCommand(WPARAM wParam, LPARAM lParam) { switch (LOWORD(wParam)) { case IDM_FILE_NEW: return OnFileNew(); case IDM_FILE_CLOSE: return OnFileClose(); case IDM_FILE_OPEN: return OnFileOpen(); case IDM_FILE_SAVE: return OnFileSave(); case IDM_FILE_SAVEAS: return OnFileSave(); case IDM_FILE_PRINT: return OnFilePrint(); case IDW_VIEW_STATUSBAR: return OnViewStatusBar(); case IDW_VIEW_TOOLBAR: return OnViewToolBar(); case IDW_MDI_ARRANGE: return OnMDIIconArrange(); case IDW_MDI_CASCADE: return OnMDICascade(); case IDW_MDI_CLOSEALL: return OnMDICloseAll(); case IDW_MDI_TILE: return OnMDITile(); case IDM_FILE_EXIT: return OnFileExit(); case IDM_HELP_ABOUT: return OnHelp(); default: // Pass to active child... { if (GetActiveMDIChild()) GetActiveMDIChild()->SendMessage(WM_COMMAND, wParam, lParam); } break ; } return FALSE; }
//!Initialize the Menu void SQLiteViewer::InitializeMenu(void) { connect(ui.actionOpen_DB,SIGNAL(triggered()),this,SLOT(OnFileOpen())); connect(ui.actionClose_DB,SIGNAL(triggered()),this,SLOT(OnFileClose())); connect(ui.actionCreate_DemoDB01,SIGNAL(triggered()),this,SLOT(OnCreateDemoDB01())); connect(ui.actionCreate_DemoDB02,SIGNAL(triggered()),this,SLOT(OnCreateDemoDB02())); connect(ui.actionCreate_DemoDB03,SIGNAL(triggered()),this,SLOT(OnCreateDemoDB03())); };
/****************************************************************************** * void MenuOnCommand(HMENU hmenu, HWND hwnd) * * frame window WM_COMMAND handler * * parameters: * wCmd - menu item id (WM_COMMAND wParam) * * returns: * TRUE if the menu item id is recognized * * notes: * The following code needs to change if there are more than 10 mru files * more than 100 default options, more than 100 tools or more than 100 transforms ******************************************************************************/ BOOL MenuOnCommand(WPARAM wCmd) { HWND hwnd = ChildGetActive(); CHILDINSTANCEDATA PICFAR* pInstance = ChildGetInstanceData(hwnd); if ( pInstance == 0 || pInstance->nWaitCursor != 0 ) hwnd = NULL; switch ( wCmd ) { case IDM_FILE_OPEN: OpenOnFileOpen(); break; case IDM_FILE_CLOSE: OnFileClose(hwnd); break; case IDM_FILE_SAVE: SaveOnFileSave(hwnd); break; case IDM_FILE_SAVEAS: SaveOnFileSaveAs(hwnd); break; case IDM_FILE_PROPERTIES: OnFileProperties(hwnd); break; case IDM_FILE_IMAGEOPTIONS: OnFileImageOptions(hwnd); break; case IDM_FILE_EXIT: SendMessage(hwndFrame, WM_CLOSE, 0, 0); break; case IDM_FILE_MRUFILE1: case IDM_FILE_MRUFILE2: case IDM_FILE_MRUFILE3: case IDM_FILE_MRUFILE4: case IDM_FILE_MRUFILE5: case IDM_FILE_MRUFILE6: case IDM_FILE_MRUFILE7: case IDM_FILE_MRUFILE8: case IDM_FILE_MRUFILE9: OpenOnFileMruOpen(wCmd - IDM_FILE_MRUFILE1 + 1); break; case IDM_WINDOW_NEWWINDOW: OnNewWindow(hwnd); break; case IDM_WINDOW_CASCADE: SendMessage(hwndMDIClient, WM_MDICASCADE, 0, 0); break; case IDM_WINDOW_TILEHORIZONTAL: SendMessage(hwndMDIClient, WM_MDITILE, MDITILE_HORIZONTAL, 0); break; case IDM_WINDOW_TILEVERTICAL: SendMessage(hwndMDIClient, WM_MDITILE, MDITILE_VERTICAL, 0); break; case IDM_WINDOW_ARRANGEICONS: SendMessage(hwndMDIClient, WM_MDIICONARRANGE, 0, 0); break; case IDM_WINDOW_CLOSEALL: OnWindowCloseAll(); break; case IDM_HELP_CONTENTS: WinHelp(hwndFrame, APPLICATION_HELPFILENAME, HELP_CONTENTS, 0); break; case IDM_HELP_ABOUT: AboutOnHelpAbout(); break; default: if ( wCmd >= IDM_FILE_DEFAULTOPTIONS && wCmd < IDM_FILE_DEFAULTOPTIONS + 100 ) OnFileDefaultOptions(wCmd); else if ( wCmd >= IDM_TRANSFORM && wCmd < IDM_TRANSFORM + 100 ) OnTransform(hwnd, wCmd); else if ( wCmd >= IDM_TOOLS && wCmd < IDM_TOOLS + 100 ) OnTools(wCmd); else return ( FALSE ); } return ( TRUE ); }
void CVisualADSDoc::MyFileClose() { OnFileClose(); }