DestroyMenu function

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

Syntax


BOOL WINAPI DestroyMenu(
  _In_  HMENU hMenu
);

Parameters

hMenu [in]

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]

Header

Winuser.h (include Windows.h)

Library

User32.lib

DLL

User32.dll

See also

Reference
CreateMenu
DeleteMenu
RemoveMenu
SetMenuItemInfo
Conceptual
Menus

 

 

Community Additions

ADD
Show:
© 2014 Microsoft