CMenu::Attach
Visual Studio .NET 2003
Attaches an existing Windows menu to a CMenu object.
BOOL Attach( HMENU hMenu );
Parameters
- hMenu
- Specifies a handle to a Windows menu.
Return Value
Nonzero if the operation was successful; otherwise 0.
Remarks
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 = AfxGetMainWnd()->GetMenu()->GetSafeHmenu(); mnu.Attach( hmnu ); // Now you can manipulate the window's menu as a CMenu // object...
See Also
CMenu Overview | Class Members | Hierarchy Chart | CMenu::Detach | CMenu::CMenu | CWnd::GetMenu