description | title | ms.date | f1_keywords | helpviewer_keywords | ms.assetid | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Learn more about: CMenuTearOffManager Class |
CMenuTearOffManager Class |
10/18/2018 |
|
|
ab7ca272-ce42-4678-95f7-6ad75038f5a0 |
Manages tear-off menus. A tear-off menu is a menu on the menu bar. The user can remove a tear-off menu from the menu bar, causing the tear-off menu to float.
For more detail see the source code located in the VC\atlmfc\src\mfc folder of your Visual Studio installation.
class CMenuTearOffManager : public CObject
Name | Description |
---|---|
CMenuTearOffManager::CMenuTearOffManager | Constructs a CMenuTearOffManager object. |
Name | Description |
---|---|
CMenuTearOffManager::Build | |
CMenuTearOffManager::GetRegPath | |
CMenuTearOffManager::Initialize | Initializes a CMenuTearOffManager object. |
CMenuTearOffManager::IsDynamicID | |
CMenuTearOffManager::Parse | |
CMenuTearOffManager::Reset | |
CMenuTearOffManager::SetInUse | |
CMenuTearOffManager::SetupTearOffMenus |
In order to use tear-off menus in your application, you must have a CMenuTearOffManager
object. In most cases, you won't create or initialize a CMenuTearOffManager
object directly. This is handled for you when you call the CWinAppEx::EnableTearOffMenus function.
The following example demonstrates how to construct and initialize a CMenuTearOffManager
object by calling the CWinAppEX::EnableTearOffMenus
method. This code snippet is part of the Word Pad sample.
[!code-cppNVC_MFC_WordPad#12]
CMenuTearOffManager
Header: afxmenutearoffmanager.h
void Build(
UINT uiTearOffBarID,
CString& strText);
[in] uiTearOffBarID
[in] strText
Constructs a CMenuTearOffManager object.
CMenuTearOffManager();
In most cases, you should not create a CMenuTearOffManager
manually. The framework of your application creates the CMenuTearOffManager
object when you call CWinAppEx::EnableTearOffMenus.
LPCTSTR GetRegPath() const;
Initializes a CMenuTearOffManager object.
BOOL Initialize(
LPCTSTR lpszRegEntry,
UINT uiTearOffMenuFirst,
UINT uiTearOffMenuLast);
lpszRegEntry
[in] A string that contains the path of a registry entry. Your applications stores the settings for tear-off bars in this registry entry.
uiTearOffMenuFirst
[in] The first menu ID for a tear-off menu.
uiTearOffMenuLast
[in] The last menu ID for a tear-off menu.
Nonzero if successful; otherwise 0.
The range of menu IDs from uiTearOffMenuFirst to uiTearOffMenuLast must be a continuous interval. The interval defines the number of tear-off menus that can appear at the same time in the application.
BOOL IsDynamicID(UINT uiID) const;
[in] uiID
UINT Parse(CString& str);
[in] str
void Reset(HMENU hmenu);
[in] hmenu
void SetInUse(
UINT uiCmdId,
BOOL bUse = TRUE);
[in] uiCmdId
[in] bUse
void SetupTearOffMenus(HMENU hMenu);
[in] hMenu