DestroyMenu function

Destroys the specified menu and frees any memory that the menu occupies.

Syntax

BOOL DestroyMenu(
  HMENU hMenu
);

Parameters

hMenu

Type: HMENU

A handle to the menu to be destroyed.

Return Value

Type: BOOL

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

Before closing, an application must use the DestroyMenu function to destroy a menu not assigned to a window. A menu that is assigned to a window is automatically destroyed when the application closes.

DestroyMenu is recursive, that is, it will destroy the menu and all its submenus.

Examples

For an example, see Displaying a Shortcut Menu.

Requirements

   
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header winuser.h (include Windows.h)
Library User32.lib
DLL User32.dll

See Also

Conceptual

CreateMenu

DeleteMenu

Menus

Reference

RemoveMenu

SetMenuItemInfo