Results 1 to 8 of 8

Thread: Menus again

  1. #1

    Thread Starter
    Hyperactive Member Amon Ra's Avatar
    Join Date
    Feb 2001
    Location
    In some cave on Uranus...
    Posts
    500

    Question Menus again

    Ok, i got my menus working al from API, and I am working on some owner-drawn ones. Let's say i change the number of menu item at one point, i need to know the number of menus left. I am thinking of a function that would go through the top menu (hMenu) and loop through the entire menus, increases a variable accordingly, and breaks out of the loop when a 0 is hit(or when there are no menus left)Anyone has any idea how to help me?(just give me clear hints, so i can actually come up with the formula myself thanks in advance
    Amon Ra
    The Power of Learning.

  2. #2

    Thread Starter
    Hyperactive Member Amon Ra's Avatar
    Join Date
    Feb 2001
    Location
    In some cave on Uranus...
    Posts
    500

    Lightbulb To clarify the previous post...

    just to clarify, i basically need to write a function that can count the number of menu items at run-time. So please, just give me a few clear hints, so ican try to figure it out Thanks
    Amon Ra
    The Power of Learning.

  3. #3

    Thread Starter
    Hyperactive Member Amon Ra's Avatar
    Join Date
    Feb 2001
    Location
    In some cave on Uranus...
    Posts
    500

    Lightbulb A few details

    It would be nice if this function could also retrieve the state of each menu and store in an array with its ID
    Amon Ra
    The Power of Learning.

  4. #4
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Platform SDK: Windows User Interface
    Menu Functions
    The following functions are used with menus.

    Function Description
    AppendMenu Appends an item to various menus and submenus.
    CheckMenuItem Checks or clears a menu item.
    CheckMenuRadioItem Checks a specified menu item and makes it a radio item.
    CreateMenu Creates a menu.
    CreatePopupMenu Creates a drop-down menu, submenu, or shortcut menu.
    DeleteMenu Deletes a menu item.
    DestroyMenu Deletes a menu.
    DrawMenuBar Redraws a menu bar.
    EnableMenuItem Enables, disables, or grays a menu item.
    EndMenu Ends the calling thread's active menu.
    GetMenu Gets a handle to the menu.
    GetMenuBarInfo Gets information about a menu bar.
    GetMenuCheckMarkDimensions Returns the dimensions of the default check-mark bitmap.
    GetMenuDefaultItem Gets the default menu item on a menu.
    GetMenuInfo Gets information about a menu.
    GetMenuItemCount Gets the number of items in a menu.
    GetMenuItemID Gets the identifier of a menu item.
    GetMenuItemInfo Gets information about a menu item.
    GetMenuItemRect Gets the bounding rectangle for a menu item.
    GetMenuState Gets the menu flags associated with a menu item.
    GetMenuString Copies the text string of a menu item into a buffer.
    GetSubMenu Gets a handle to the drop-down menu or submenu activated by a menu item.
    GetSystemMenu Allows copying or modifying of a window menu.
    HiliteMenuItem Highlights or removes the highlighting from an item in a menu bar.
    InsertMenu Inserts a new menu item into a menu.
    InsertMenuItem Inserts a new menu item in a menu.
    IsMenu Determines when a handle is a menu handle.
    LoadMenu Loads a menu resource.
    LoadMenuIndirect Loads a specified menu template.
    MenuItemFromPoint Determines which menu item is at a specified location.
    ModifyMenu Changes an existing menu item.
    RemoveMenu Deletes a menu item or detaches a submenu from a menu.
    SetMenu Assigns a new menu to a window.
    SetMenuDefaultItem Sets the default menu item for a menu.
    SetMenuInfo Sets information for a menu.
    SetMenuItemBitmaps Associates a bitmap with a menu item.
    SetMenuItemInfo Changes information about a menu item.
    TrackPopupMenu Displays a shortcut menu at a location and tracks item selection on a menu.
    TrackPopupMenuEx Displays a shortcut menu at a location and tracks item selection on a shortcut menu.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  5. #5

    Thread Starter
    Hyperactive Member Amon Ra's Avatar
    Join Date
    Feb 2001
    Location
    In some cave on Uranus...
    Posts
    500

    Thumbs up ok

    THanks Parksie, i will work with that
    Amon Ra
    The Power of Learning.

  6. #6
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Be on your guard for things that are 98/2000 specific, because I noticed a few while browsing through the docs.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  7. #7

    Thread Starter
    Hyperactive Member Amon Ra's Avatar
    Join Date
    Feb 2001
    Location
    In some cave on Uranus...
    Posts
    500

    Cool One more thing

    If i have
    Code:
    THEITEM item[];
    can i do that after i wrote my function
    Code:
    item[mennumber];
    If not, how would i resize the array to the number of menus?
    Amon Ra
    The Power of Learning.

  8. #8
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    No. You need:
    Code:
    THEITEM *pItems;
    
    // ...find the number of items...
    
    pItems = new THEITEM[number_of_items];
    
    // ...use the array...
    
    delete[] pItems; // Kill it off again
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

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