SetMenu

2.x

  BOOL SetMenu(hwnd, hmenu)    
  HWND hwnd; /* handle of window, */  
  HMENU hmenu; /* handle of menu, */  

The SetMenu function sets the given window's menu to the specified menu.

Parameters

hwnd

Identifies the window whose menu is to be changed.

hmenu

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

Return Value

The return value is nonzero if the function is successful. Otherwise, it is zero.

Comments

The SetMenu function causes the window to be redrawn to reflect the menu change.

SetMenu will not destroy a previous menu. An application should call the DestroyMenu function to accomplish this task.

Example

HMENU hmenu;

hmenu = LoadMenu(hinst, "My Menu");
SetMenu(hwnd, hmenu);

See Also

DestroyMenu, LoadMenu, LoadMenuIndirect