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.
The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.
The latest version of this topic can be found at CMenuTearOffManager Class.
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.
Syntax
class CMenuTearOffManager : public CObject
Members
Public Constructors
| Name | Description |
|---|---|
| CMenuTearOffManager::CMenuTearOffManager | Constructs a CMenuTearOffManager object. |
Public Methods
| Name | Description |
|---|---|
| CMenuTearOffManager::Build | |
| CMenuTearOffManager::GetRegPath | |
| CMenuTearOffManager::Initialize | Initializes a CMenuTearOffManager object. |
| CMenuTearOffManager::IsDynamicID | |
| CMenuTearOffManager::Parse | |
| CMenuTearOffManager::Reset | |
| CMenuTearOffManager::SetInUse | |
| CMenuTearOffManager::SetupTearOffMenus |
Remarks
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.
Example
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.
// The EnableTearOffMenus method is inherited from the CWinAppEx class.
EnableTearOffMenus (NULL, ID_FREE_TEAROFF1, ID_FREE_TEAROFF2);
Inheritance Hierarchy
Requirements
Header: afxmenutearoffmanager.h
CMenuTearOffManager::Build
This topic is included for completeness. For more detail see the source code located in the VC\atlmfc\src\mfc folder of your Visual Studio installation.
void Build(
UINT uiTearOffBarID,
CString& strText);
Parameters
[in] uiTearOffBarID
[in] strText
Remarks
CMenuTearOffManager::CMenuTearOffManager
Constructs a CMenuTearOffManager object.
CMenuTearOffManager();
Remarks
In most cases, you should not create a CMenuTearOffManager manually. The framework of your application creates the CMenuTearOffManager object when you call CWinAppEx::EnableTearOffMenus.
CMenuTearOffManager::GetRegPath
This topic is included for completeness. For more detail see the source code located in the VC\atlmfc\src\mfc folder of your Visual Studio installation.
LPCTSTR GetRegPath() const;
Return Value
Remarks
CMenuTearOffManager::Initialize
Initializes a CMenuTearOffManager object.
BOOL Initialize(
LPCTSTR lpszRegEntry,
UINT uiTearOffMenuFirst,
UINT uiTearOffMenuLast);
Parameters
[in] lpszRegEntry
A string that contains the path of a registry entry. Your applications stores the settings for tear-off bars in this registry entry.
[in] uiTearOffMenuFirst
The first menu ID for a tear-off menu.
[in] uiTearOffMenuLast
The last menu ID for a tear-off menu.
Return Value
Nonzero if successful; otherwise 0.
Remarks
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.
CMenuTearOffManager::IsDynamicID
This topic is included for completeness. For more detail see the source code located in the VC\atlmfc\src\mfc folder of your Visual Studio installation.
BOOL IsDynamicID(UINT uiID) const;
Parameters
[in] uiID
Return Value
Remarks
CMenuTearOffManager::Parse
This topic is included for completeness. For more detail see the source code located in the VC\atlmfc\src\mfc folder of your Visual Studio installation.
UINT Parse(CString& str);
Parameters
[in] str
Return Value
Remarks
CMenuTearOffManager::Reset
This topic is included for completeness. For more detail see the source code located in the VC\atlmfc\src\mfc folder of your Visual Studio installation.
void Reset(HMENU hmenu);
Parameters
[in] hmenu
Remarks
CMenuTearOffManager::SetInUse
This topic is included for completeness. For more detail see the source code located in the VC\atlmfc\src\mfc folder of your Visual Studio installation.
void SetInUse(
UINT uiCmdId,
BOOL bUse = TRUE);
Parameters
[in] uiCmdId
[in] bUse
Remarks
CMenuTearOffManager::SetupTearOffMenus
This topic is included for completeness. For more detail see the source code located in the VC\atlmfc\src\mfc folder of your Visual Studio installation.
void SetupTearOffMenus(HMENU hMenu);
Parameters
[in] hMenu