Step 5:

Application developed with Microsoft Visual C++, Part 9.


7th Step
, Remove items from the sytem/window menu



System/Window menu: A pop-up menu, defined mainly by the operating system, that typically contains commands used to set a window's size or position, close a window or application, or activate a different application. This
menu appears in the top of an application's window and can be accessed by clicking
the right mouse button.

  1. The IDD_TESTVC0_DIALOG dialog and the system/window menu design - before modification.

    Learn how to write a Visual C++ application ...

    Note:
    The window menu includes seven items: Restore, Move, Size, Minimize, Maximize, Close and
    About TestVC0.

  2. The IDD_TESTVC0_DIALOG dialog and the system/window menu design - after modification.

    Learn how to write a Visual C++ application ...

    Note:
    The five menu items: Restore, Move, Minimize, Close and About TestVC0.

  3. Remove operation ...
    Two items to be remove from the window/system menu - Size and Maximize.
    For this, use
    RemoveMenu command, member of CMenu class to delete these menu items.

    Note:
    Remove the Maximize item, because it isn't a member of IDD_TESTVC0_ DIALOG dialog Properties.
    Remove the size item, because the size of IDD_TESTVC_DIALOG dialog is fixed.

    On the View menu, click ClassWizard, the MFC ClassWizard dialog box appears and then click
    the Message Maps tab.
    1. In the Class name box, select the class CTestVC0Dlg.
    2. In the Member Functions list, select the function name - OnInitDialog.
    3. Choose Edit Code
      -or-
      Double-click the function name.
      The insertion point moves to the function - OnInitDialog in the TestVC0Dlg.cpp file, and
      then add the following Text Code:
      //Remove the Maximize and Size items
      pSysMenu->RemoveMenu(SC_SIZE, MF_BYCOMMAND);
      pSysMenu->RemoveMenu(SC_MAXIMIZE, MF_BYCOMMAND);

      Examine these changes, click here.

    Note:
    Save this application.
    Run
    it, from Build menu, choose and click Execute TestVC0.exe.


Previous
Home 9 Home
Next