7.7.7 Modifying the WM_COMMAND Case

Your application must be able to process menu commands. In this application, instead of performing tasks, all menu commands activate a “Command not implemented” message box. Replace the WM_COMMAND case with the following statements:

case WM_COMMAND:
    switch (wParam) {
        case IDM_ABOUT:
            lpProcAbout =
                MakeProcInstance((FARPROC) About, hInst);
            DialogBox(hInst, "AboutBox", hWnd,
                (DLGPROC) lpProcAbout);
            FreeProcInstance(lpProcAbout);
            break;

        /* File-menu commands */

        case IDM_NEW:
        case IDM_OPEN:
        case IDM_SAVE:
        case IDM_SAVEAS:
        case IDM_PRINT:





            MessageBox(
                GetFocus(),
                "Command not implemented",
                "EditMenu Sample Application",
                MB_ICONASTERISK | MB_OK);
            break;

        case IDM_EXIT:
            DestroyWindow(hWnd);
            break;

        /* Edit-menu commands */

        case IDM_UNDO:
        case IDM_CUT:
        case IDM_COPY:
        case IDM_PASTE:
        case IDM_CLEAR:
            MessageBox(
                GetFocus(),
                "Command not implemented",
                "EditMenu Sample Application",
                MB_ICONASTERISK | MB_OK);
            break;
    }
    break;