Back

DupeMenu()




    USAGE

    Menu = (struct Menu *) DupeMenu(MenuList)

    FUNCTION

    This makes a copy of the supplied menu. Menu and MenuItem structures are allocated and copied into. Structures used for rendering, such as Images and IntuiText, are not copied, just the pointer to them are duplicated.
    The purpose of this routine is to provide a method for generating multiple copies of the same window, so they can run concurrently.
    To do this, create your static Menu (probably using for example POWERWindows). Dupe it with this routine. Stick the duplicate copy in a new window with SetMenuStrip. You might create a seperate task that opens that window. Dupe the menu again and create another task that opens another window, using that menu. Although identical copies of the same window will exist on the screen, mucking with one menu can not effect the other. When each task is done, it calls ClearMenuStrip, then returns the menu with a call to DeleteMenu.
    Note that now you are generating Menus dynamically, you will need to use GetMenu and GetMenuItem if you need to access the Menu and MenuItem structures that make up your menu.
    INPUTS

    MenuList = Pointer to a menu to copy.

    RESULT

    Menu = Pointer to the copied list, or NULL if it ran out of memory.

    SEE ALSO
    DeleteMenu, GetMenu, GetMenuItem, EnableMenu, EnableMenuItem, CheckMenuItem