Share via


CMenu::Attach

BOOLAttach(HMENUhMenu**);**

Return Value

Nonzero if the operation was successful; otherwise 0.

Parameters

hMenu

Specifies a handle to a Windows menu.

Remarks

Attaches an existing Windows menu to a CMenu object. This function should not be called if a menu is already attached to the CMenu object. The menu handle is stored in the m_hMenu data member.

If the menu you want to manipulate is already associated with a window, you can use the CWnd::GetMenu function to get a handle to the menu.

Example

CMenu mnu;
HMENU hmnu = pWnd->GetMenu( );
mnu.Attach( hmnu );
// Now you can manipulate the window's menu as a CMenu
// object...

CMenu OverviewClass MembersHierarchy Chart

See Also   CMenu::Detach, CMenu::CMenu, CWnd::GetMenu