CMFCRibbonApplicationButton 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 CMFCRibbonApplicationButton Class.

Implements a special button located in the top-left corner of the application window. When clicked, the button opens a menu that usually contains common File commands like Open, Save, and Exit.

Syntax

class CMFCRibbonApplicationButton : public CMFCRibbonButton  

Members

Public Constructors

Name Description
CMFCRibbonApplicationButton::CMFCRibbonApplicationButton Constructs and initializes a CMFCRibbonApplicationButton object.

Public Methods

Name Description
CMFCRibbonApplicationButton::CreateObject Used by the framework to create a dynamic instance of this class type.
CMFCRibbonApplicationButton::GetThisClass Used by the framework to obtain a pointer to the CRuntimeClass object that is associated with this class type.
CMFCRibbonApplicationButton::SetImage Assigns an image to the ribbon application button.

Example

The following example demonstrates how to use various methods in the CMFCRibbonApplicationButton class. The example shows how to assign an image to the application button, and how to set its tooltip. This code snippet is part of the Draw Client sample.

 CMFCRibbonApplicationButton m_MainButton;
 m_MainButton.SetImage(IDB_RIBBON_MAIN);
    m_MainButton.SetToolTipText(_T("File"));
    // Set the short cut keyboard text.
    m_MainButton.SetText(_T("f"));

Inheritance Hierarchy

CObject

CMFCRibbonBaseElement

CMFCRibbonButton

CMFCRibbonApplicationButton

Requirements

Header: afxRibbonBar.h

CMFCRibbonApplicationButton::CMFCRibbonApplicationButton

Constructs and initializes a CMFCRibbonApplicationButton object.

CMFCRibbonApplicationButton();  
CMFCRibbonApplicationButton(UINT uiBmpResID);  
  CMFCRibbonApplicationButton(HBITMAP hBmp);

Parameters

uiBmpResID
The resource ID of the image to display on the application button.

hBmp
A handle to a bitmap to display on the application button.

Remarks

The ribbon application button is a special button that is located in the upper-left corner of the application window. When a user clicks this button, the application opens a menu that usually contains common File commands, such as Open, Save, and Exit.

CMFCRibbonApplicationButton::SetImage

Assigns an image to the application button.

void SetImage(UINT uiBmpResID);  
void SetImage(HBITMAP hBmp);
```  
  
### Parameters  
 [in] `uiBmpResID`  
 The resource ID of the image to display on the application button.  
  
 [in] `hBmp`  
 A handle to a bitmap to display on the application button.  
  
### Remarks  
 Use this method to assign a new image to the ribbon application button after you create the button. The application button is located in the upper-left corner of the application window.  
  
## See Also  
 [Hierarchy Chart](../Topic/Hierarchy%20Chart.md)   
 [Classes](../Topic/MFC%20Classes.md)   
 [CMFCRibbonButton Class](../Topic/CMFCRibbonButton%20Class.md)