# Function Reference

# _GUICtrlMenu_RemoveMenu

Deletes a menu item or detaches a submenu from the specified menu

#include <GuiMenu.au3>
_GUICtrlMenu_RemoveMenu ( $hMenu, $iItem [, $bByPos = True] )

## Parameters

$hMenu | Handle to the menu to be changed
$iItem | Identifier or position of the menu item
$bByPos | [optional] Menu identifier flag: True - $iItem is a 0-based item position False - $iItem is a menu item identifier

## Return Value

Success: | True.
Failure: | False.

## Remarks

If the menu item opens a drop down menu or submenu, _GUICtrlMenu_RemoveMenu() does not destroy the menu or its handle, allowing the menu to be reused.
Before this function is called, the _GUICtrlMenu_GetItemSubMenu() function should be used retrieve a handle to the drop-down menu or submenu.

## Related

_GUICtrlMenu_GetItemSubMenu

## See Also

Search RemoveMenu in MSDN Library.

## Example

    #include <GuiMenu.au3>

    Example()

    Func Example()
        Local $hWnd, $hMain

        ; Open Notepad
        Run("notepad.exe")
        WinWaitActive("[CLASS:Notepad]")
        $hWnd = WinGetHandle("[CLASS:Notepad]")
        $hMain = _GUICtrlMenu_GetMenu($hWnd)

        ; Remove Help menu
        _GUICtrlMenu_RemoveMenu($hMain, 4)
    EndFunc   ;==>Example