Поделиться через


CMenu::Attach

Attaches an existing Windows menu to a CMenu object.

BOOL Attach(
   HMENU hMenu 
);

Параметры

  • hMenu
    Specifies a handle to a Windows menu.

Возвращаемое значение

Nonzero if the operation was successful; otherwise 0.

Заметки

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.

Пример

CMenu mnu;
HMENU hmnu = AfxGetMainWnd()->GetMenu()->GetSafeHmenu();
mnu.Attach(hmnu);

// Now you can manipulate the window's menu as a CMenu
// object...

mnu.Detach();

Требования

Header: afxwin.h

См. также

Основные понятия

CMenu Class

CMenu Members

Hierarchy Chart

CMenu::Detach

CMenu::CMenu

CWnd::GetMenu