DestroyMenu function (winuser.h)
Destroys the specified menu and frees any memory that the menu occupies.
BOOL DestroyMenu(
[in] HMENU hMenu
);
[in] hMenu
Type: HMENU
A handle to the menu to be destroyed.
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.
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.
For an example, see Displaying a Shortcut Menu.
Requirement | Value |
---|---|
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 |
API set | ext-ms-win-ntuser-menu-l1-1-0 (introduced in Windows 8) |
Conceptual
Reference