CMenuTearOffManager Class

 

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.

class CMenuTearOffManager : public CObject  

Public Constructors

NameDescription
CMenuTearOffManager::CMenuTearOffManagerConstructs a CMenuTearOffManager object.

Public Methods

NameDescription
CMenuTearOffManager::Build
CMenuTearOffManager::GetRegPath
CMenuTearOffManager::InitializeInitializes 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.

	// The EnableTearOffMenus method is inherited from the CWinAppEx class.
	EnableTearOffMenus (NULL, ID_FREE_TEAROFF1, ID_FREE_TEAROFF2);

CObject

CMenuTearOffManager

Header: afxmenutearoffmanager.h

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

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.

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

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.

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

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

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

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

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

Remarks

Hierarchy Chart
Classes
CWinAppEx Class

Show: