Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
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...
mnu.Detach();
Requirements
Header: afxwin.h