UIRibbonImageFromBitmapFactory object
Implements the IUIImageFromBitmap interface.
Remarks
Creation\Access Functions
Use any of the following to retrieve a reference to the object:
CoCreateInstance | Call CoCreateInstance setting the class ID (CLSID) parameter to CLSID_UIRibbonImageFromBitmapFactory. |
Interfaces Implemented
IUIImageFromBitmap |
Examples
The following example demonstrates a Ribbon framework image factory method that loads an image from the Ribbon resource file.
The m_pifbFactory member variable is a pointer to an IUIImageFromBitmap object.
// Factory method to create IUIImages from resource identifiers.
HRESULT CShapeHandler::CreateUIImageFromBitmapResource(
LPCTSTR pszResource, __out IUIImage **ppimg)
{
HRESULT hr = E_FAIL;
*ppimg = NULL;
if (NULL == m_pifbFactory)
{
hr = CoCreateInstance(
CLSID_UIRibbonImageFromBitmapFactory,
NULL,
CLSCTX_ALL,
IID_PPV_ARGS(&m_pifbFactory));
if (FAILED(hr))
{
return hr;
}
}
// Load the bitmap from the resource file.
HBITMAP hbm = NULL;
hbm = (HBITMAP) LoadImage(
GetModuleHandle(NULL),
pszResource,
IMAGE_BITMAP,
0,
0,
LR_CREATEDIBSECTION);
if (NULL == hbm)
{
return HRESULT_FROM_WIN32(GetLastError());
}
// Use the factory implemented by the framework to produce an IUIImage.
hr = m_pifbFactory->CreateImage(hbm, UI_OWNERSHIP_TRANSFER, ppimg);
if (FAILED(hr))
{
DeleteObject(hbm);
}
return hr;
}
Requirements
Minimum supported client |
Windows 7, Windows Vista with SP2 and Platform Update for Windows Vista [desktop apps only] |
Minimum supported server |
Windows Server 2008 R2, Windows Server 2008 with SP2 and Platform Update for Windows Server 2008 [desktop apps only] |
Header |
Uiribbon.h |
IDL |
Uiribbon.idl |
DLL |
Uiribbon.dll |
IID |
CLSID_UIRibbonImageFromBitmapFactory is defined as 0F7434B6-59B6-4250-999E-D168D6AE4293 |