How to: Add Ribbon Controls and Event Handlers
Ribbon controls are elements, such as buttons and combo boxes, that you add to panels. Panels are areas of the ribbon bar that display a group of related controls.
In this topic, you will open the Ribbon Designer, add a button, and then link an event that displays "Hello World".
To open the Ribbon Designer
In Visual Studio, on the View menu, click Resource View.
In Resource View, double-click the ribbon resource to display it on the design surface.
To add a Button and an Event Handler
From the Toolbar, click Button and drag it on to a panel in the design surface.
Right-click the button, and click Add Event Handler.
In the Event Handler Wizard, confirm the default settings and click Add and Edit. For more information, see Event Handler Wizard.
In the code editor, add the following code into the handler function:
MessageBox((LPCTSTR)L"Hello World");
See also
RibbonGadgets Sample: Ribbon Gadgets Application
Ribbon Designer (MFC)