|
class CApplication
: public CComObjectRootEx<CComMultiThreadModel>
, public IUIApplication
, public IUICommandHandler
{
public:
BEGIN_COM_MAP(CApplication)
COM_INTERFACE_ENTRY(IUIApplication)
COM_INTERFACE_ENTRY(IUICommandHandler)
END_COM_MAP()
STDMETHOD(OnViewChanged)(UINT viewId, __in UI_VIEWTYPE typeID, __in IUnknown* pView, UI_VIEWVERB verb, INT uReasonCode);
STDMETHOD(OnCreateUICommand)(UINT32 nCmdID,
__in UI_COMMANDTYPE typeID,
__deref_out IUICommandHandler** ppCommandHandler);
{
*ppCommandHandler = this; // Register the command handler class as the same class
AddRef();
return S_OK;
}
STDMETHOD(Activate)(BOOL fInputActive);
STDMETHOD(OnDestroyUICommand)(UINT32 commandId, __in UI_COMMANDTYPE typeID, __in_opt IUICommandHandler* commandHandler);
// User action callback, with transient execution parameters
STDMETHOD(Execute)(UINT nCmdID,
UI_EXECUTIONVERB verb,
__in_opt const PROPERTYKEY* key,
__in_opt const PROPVARIANT* ppropvarValue,
__in_opt IUISimplePropertySet* pCommandExecutionProperties)
{
MessageBox(NULL, L"Got the event", L"Action message", MB_OK); //Recieves messages for any action on ribbon buttons
}
// Asks the application for a specific property value
STDMETHOD(UpdateProperty)(UINT nCmdID,
__in REFPROPERTYKEY key,
__in_opt const PROPVARIANT* ppropvarCurrentValue,
__out PROPVARIANT* ppropvarNewValue);
};
|