UID | title | description | helpviewer_keywords | old-location | tech.root | ms.assetid | ms.date | ms.keywords | req.header | req.include-header | req.target-type | req.target-min-winverclnt | req.target-min-winversvr | req.kmdf-ver | req.umdf-ver | req.ddi-compliance | req.unicode-ansi | req.idl | req.max-support | req.namespace | req.assembly | req.type-library | req.lib | req.dll | req.irql | targetos | req.typenames | req.redist | req.product | ms.custom | f1_keywords | dev_langs | topic_type | api_type | api_location | api_name | |||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
NF:uiribbon.IUIApplication.OnViewChanged |
IUIApplication::OnViewChanged (uiribbon.h) |
Called when the state of a View changes. |
|
windowsribbon\windowsribbon_iuiapplication_onviewchanged.htm |
windowsribbon |
VS|scenicintent|~\scenicintent\reference\ifaces\iuiapplication\onviewchanged.htm |
12/05/2018 |
IUIApplication interface [Windows Ribbon],OnViewChanged method, IUIApplication.OnViewChanged, IUIApplication::OnViewChanged, OnViewChanged, OnViewChanged method [Windows Ribbon], OnViewChanged method [Windows Ribbon],IUIApplication interface, scenicintent_IUIApplication_OnViewChanged, uiribbon/IUIApplication::OnViewChanged, windowsribbon.windowsribbon_iuiapplication_onviewchanged |
uiribbon.h |
Windows |
Windows 7 [desktop apps only] |
Windows Server 2008 R2 [desktop apps only] |
Uiribbon.idl |
Mshtml.dll |
Windows |
Windows UI |
19H1 |
|
|
|
|
|
|
Called when the state of a View changes.
Type: UINT32
The ID for the View. Only a value of 0 is valid.
Type: UI_VIEWTYPE
The UI_VIEWTYPE hosted by the application.
Type: IUnknown*
A pointer to the View interface.
Type: UI_VIEWVERB
The UI_VIEWVERB (or action) performed by the View.
Type: INT32
Not defined.
Type: HRESULT
If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
This callback notification is sent by the framework to the host application on each View state change.
Important This callback only occurs for the Ribbon View with a viewId of 0.
The following example demonstrates a basic implementation of the IUIApplication::OnViewChanged method.
//
// FUNCTION: OnViewChanged(UINT, UI_VIEWTYPE, IUnknown*, UI_VIEWVERB, INT)
//
// PURPOSE: Called when the state of a View (Ribbon is a view) changes - like created/destroyed/resized.
//
// PARAMETERS:
// viewId - The View identifier.
// typeID - The View type.
// pView - Pointer to the View interface.
// verb - The action performed by the View.
// uReasonCode - Not defined.
//
// COMMENTS:
//
// For this sample, return the same command handler for all commands
// specified in the .xml file.
//
//
STDMETHODIMP CApplication::OnViewChanged(
UINT viewId,
UI_VIEWTYPE typeId,
IUnknown* pView,
UI_VIEWVERB verb,
INT uReasonCode)
{
HRESULT hr = E_NOTIMPL;
// Checks to see if the view that was changed was a Ribbon view.
if (UI_VIEWTYPE_RIBBON == typeId)
{
switch (verb)
{
// The view was newly created.
case UI_VIEWVERB_CREATE:
_cwprintf(L"IUIApplication::OnViewChanged called with verb=CREATE\r\n");
if (NULL == g_pRibbon)
{
// Retrieve and store the IUIRibbon
hr = pView->QueryInterface(&g_pRibbon);
}
break;
// The view was resized.
// In the case of the Ribbon view, the application should call
// GetHeight() to determine the height of the Ribbon.
case UI_VIEWVERB_SIZE:
_cwprintf(L"IUIApplication::OnViewChanged called with verb=SIZE\r\n");
// Call to the framework to determine the height of the Ribbon.
if (NULL != g_pRibbon)
{
UINT uRibbonHeight;
hr = g_pRibbon->GetHeight(&uRibbonHeight);
}
if (!SUCCEEDED(hr))
{
//_cwprintf(L"IUIRibbon::GetHeight() failed with hr=0x%X\r\n", hr);
}
break;
// The view was destroyed.
case UI_VIEWVERB_DESTROY:
//_cwprintf(L"IUIApplication::OnViewChanged called with verb=DESTROY\r\n");
g_pRibbon = NULL;
hr = S_OK;
break;
}
}
return hr;
}