Results 1 to 6 of 6

Thread: System Context Menu

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2000
    Posts
    299

    Question

    How do i change the Grayed portion of a menu. EG i have used AppendMenu to add it with the WM_STRING and the WM_GRAYED flags set. How do i remove the Grayed part so it is enabled again, without removing it and re-adding it?
    Surely there is a way?
    BW

  2. #2
    Junior Member
    Join Date
    Feb 2001
    Location
    Singapore
    Posts
    24

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2000
    Posts
    299

    Smile Yup seen that one

    But it doesn't cover the Grayed or enabled part of it. It talks about the Checked state, which is fine. I wanna know about the Grayed state.
    BW

  4. #4
    Junior Member
    Join Date
    Feb 2001
    Location
    Singapore
    Posts
    24
    You can make use of EnableMenuItem to enable and Gray a menu item© By the way, does anyone know how you can assign Keyboard Accelerator to a menu item?? For example, if you press Shift+Y, it will be like selecting the menu item©
    Thanks


    Public Declare Function EnableMenuItem Lib "user32" Alias "EnableMenuItem" ¥ByVal hMenu As Long, ByVal wIDEnableItem As Long, ByVal wEnable As Long¤ As Long


    lret = GetMenuState¥a, 998, MF_STRING¤
    If lret = MF_GRAYED Then
    EnableMenuItem a, 998, MF_STRING
    Else
    EnableMenuItem a, 998, MF_GRAYED
    End If

  5. #5
    coder. Lord Orwell's Avatar
    Join Date
    Feb 2001
    Location
    Elberfeld, IN
    Posts
    7,628
    Declare Function SetMenuItemInfo& Lib "user32" Alias "SetMenuItemInfoA" (ByVal _
    hMenu As Long, ByVal un As Long, ByVal bypos As Long, lpcMenuItemInfo As _
    MENUITEMINFO)
    Type MENUITEMINFO ' 44 Bytes
    cbSize As Long
    fMask As Long
    fType As Long
    fState As Long
    wID As Long
    hSubMenu As Long
    hbmpChecked As Long
    hbmpUnchecked As Long
    dwItemData As Long
    dwTypeData As Long
    cch As Long
    End Type
    Code:
    cbSize	Long—Size of this structure, currently at 44 bytes.
    fMask	Long—Specifies the information to set or get. Any combination of the following:MIIM_CHECKMARKS: Sets or gets the hbmpChecked and hbmpUnchecked fields.MIIM_DATA: Sets or gets the dwItemData field.MIIM_ID: Sets or gets the wID field.MIIM_STATE: Sets or gets the fState field.MIIM_SUBMENU: Sets or gets the hSubMenu field.MIIM_TYPE: Sets or gets the fType and dwTypeData fields.
    fType	Long—Menu item type, any combination of the following with the exception that MFT_BITMAP, MFT_SEPARATOR, and MFT_STRING cannot be combined with one another:MFT_BITMAP: Displays the menu item using a bitmap. dwTypeData contains the bitmap handle.MFT_MENUBARBREAK: The menu item is placed on a new line for top level menus, a new column for popup menus. Places a line between the columns.MFT_MENUBREAK: Same as MFT_MENUBREAK without the vertical line.MFT_OWNERDRAW: The menu item is an owner-draw menu.MFT_RADIOCHECK: Uses a radio button (option button) bullet to indicate the checked state instead of a check mark. Applies if no custom bitmap is specified.MFT_RIGHTJUSTIFY: Right-justifies a top level menu item.MFT_SEPARATOR: The entry is a separator line in a pop-up menu.MFT_STRING: The entry contains a string. dwTypeData contains the address of the string, and the cch field contains the length of the string.
    fState	Long—Current menu entry state or action to take.  May be any combination of the following:MFS_CHECKED: Entry is checked.MFS_DEFAULT: The entry is a default item 
    The easiest way to make a hotkey for a menu is put a & in front of one of the letters.
    
    (appears in bold).MFS_DISABLED: Entry is disabled.MFS_ENABLED: Entry is enabled.MFS_GRAYED: Entry is grayed and disabled.MFS_HILITE: Entry is highlighted.MFS_UNCHECKED: Entry is unchecked.MFS_UNHILITE: Entry is unhighlighted.
    wID	Long—Menu entry identifier. The high 16 bits are not used.
    hSubMenu	Long—Handle to a pop-up menu if one is associated with the menu entry.
    hbmpChecked	Long—Handle to a bitmap to display for a menu entry when checked. Zero to use the default.
    hbmpUnchecked	Long—Handle to a bitmap to display for a menu entry when unchecked. Zero to use the default.
    dwItemData	Long—User-defined value associated with this entry.
    dwTypeData	Long—Depends on the menu type.
    cch	Long—Length of the menu string when MFT_STRING is specified. Zero for other menu types.
    My light show youtube page (it's made the news) www.youtube.com/@lightsofelberfeld
    Contact me on the socials www.facebook.com/lordorwell

  6. #6
    coder. Lord Orwell's Avatar
    Join Date
    Feb 2001
    Location
    Elberfeld, IN
    Posts
    7,628
    You can choose which letter of a menu option is the accellerator key by putting a & in front of it.
    My light show youtube page (it's made the news) www.youtube.com/@lightsofelberfeld
    Contact me on the socials www.facebook.com/lordorwell

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width