Disabling the main frame menu options

This is a discussion on Disabling the main frame menu options within the Windows Programming forums, part of the Platform Specific Boards category; Is it possible to disable certain menu options of the application's MainFrame? I need to disable/gray certain options, like saving, ...

  1. #1
    Registered User
    Join Date
    Oct 2002
    Posts
    7

    Disabling the main frame menu options

    Is it possible to disable certain menu options of the application's MainFrame? I need to disable/gray certain options, like saving, based on the user's access level, but the resource editor isn't helping. In Visual C++ 5, I select "gray" in the properties but when I run the application it seems to have no effect. It works on my context menu, just not on the main menu. I also can't even find the code that creates & handles the main menu; where is it for a SDI application?

    Thanks in advance

  2. #2
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,831
    >>> Is it possible to disable certain menu options of the application's MainFrame?

    Yes. I'm guessing you are using MFC, and as MFC is just a wrapper around the >Win32 API, and you can do it with the API, then you should have no problem doing it with MFC.

    I don't use MFC, but I'm guessing, you could create a CMenu object and attach it to your window with InsertMenu. You could then use the CMenu objects methods to enable/disable items.

    You may also find your window already has the CMenu object in it, is there a pointer or something in your class?
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  3. #3
    Registered User
    Join Date
    Oct 2002
    Posts
    7
    Right, I am using MFC...

    I looked through the CMainFrame:: functions, like OnShowWindow and OnCreate and found where it creates the toolbar and status bar, but no main menu. Also no menu creator in my CDocument or CView classes. I guess it's being created somewhere else, which explains why the resource editor has no effect, but where?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Menu Item Caption - /a for right aligned Accelerator?
    By JasonD in forum Windows Programming
    Replies: 6
    Last Post: 06-25-2003, 12:14 PM
  2. Going back to a main menu from anywhere
    By Gades in forum C Programming
    Replies: 5
    Last Post: 11-13-2001, 04:22 PM
  3. quick question about C Dos text menu pgm i was doing
    By Shadow in forum C Programming
    Replies: 2
    Last Post: 09-16-2001, 11:26 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21