SetMenu

The SetMenu function assigns a new menu to the specified window.

BOOL SetMenu(

HWND hWnd, // handle of window
HMENU hMenu // handle of menu
);  

Parameters

hWnd

Identifies the window to which the menu is to be assigned.

hMenu

Identifies the new menu. If this parameter is NULL, the window's current menu is removed.

Return Values

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

The window is redrawn to reflect the menu change.

The SetMenu function replaces the previous menu, if any, but it does not destroy it. An application should call the DestroyMenu function to accomplish this task.

See Also

DestroyMenu, GetMenu