Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Specifies an image list that contains button images for a toolbar embedded in a thumbnail image of a window in a taskbar button flyout.
Syntax
HRESULT ThumbBarSetImageList(
[in] HWND hwnd,
[in] HIMAGELIST himl
);
Parameters
[in] hwnd
Type: HWND
The handle of the window whose thumbnail representation contains the toolbar to be updated. This handle must belong to the calling process.
[in] himl
Type: HIMAGELIST
The handle of the image list that contains all button images to be used in the toolbar.
Return value
Type: HRESULT
If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
Remarks
Applications must provide these button images:
- The button in its default active state.
- Images suitable for use with high-dpi (dots per inch) displays.
Images must be 32-bit and of dimensions GetSystemMetrics(SM_CXICON) x GetSystemMetrics(SM_CYICON). The toolbar itself provides visuals for a button's clicked, disabled, and hover states.
Accessibility
The button images supplied in the THUMBBUTTON structure indexed from the image list can be used in a variety of user personalization scenarios. A common example is light and dark color modes and contrast themes for accessibility. Choose assets that remain visually clear in all these contexts.
You can handle this in two ways:
- Register for theme change events (see Support Dark and Light themes in Win32 apps) and update buttons when themes change.
- Use assets with built-in contrast, like glyphs with solid white fills and solid black outlines.
Examples
The following example shows how to create a thumbnail toolbar with two buttons whose images come from an image list.
HRESULT AddThumbBarButtons(HWND hwnd, HIMAGELIST himl, HIMAGELIST himlHot)
{
// Define an array of two buttons. These buttons provide images through an
// image list and also provide tooltips.
DWORD dwMask = THB_BITMAP | THB_TOOLTIP | THB_FLAGS;
THUMBBUTTON thbButtons[2];
thbButtons[0].dwMask = dwMask;
thbButtons[0].iId = 0;
thbButtons[0].iBitmap = 0;
thbButtons[0].pszTip = TEXT("Button 1");
thbButtons[0].dwFlags = THBF_DISMISSONCLICK;
dwMask = THB_BITMAP | THB_TOOLTIP;
thbButtons[1].dwMask = dwMask;
thbButtons[1].iId = 1;
thbButtons[1].iBitmap = 1;
thbButtons[1].pszTip = TEXT("Button 2");
// Create an instance of ITaskbarList3
ITaskBarList3 *ptbl;
HRESULT hr = CoCreateInstance(CLSID_TaskbarList,
NULL,
CLSCTX_INPROC_SERVER,
IID_PPV_ARGS(&ptbl);
if (SUCCEEDED(hr))
{
// Declare the image list that contains the button images.
hr = ptbl->ThumbBarSetImageList(hwnd, himl);
if (SUCCEEDED(hr))
{
// Attach the toolbar to the thumbnail.
hr = ptbl->ThumbBarAddButtons(hwnd, ARRAYSIZE(thbButtons), &thbButtons);
}
ptbl->Release();
}
return hr;
}
Requirements
| Requirement | Value |
|---|---|
| Minimum supported client | Windows 7 [desktop apps only] |
| Minimum supported server | Windows Server 2008 R2 [desktop apps only] |
| Target Platform | Windows |
| Header | shobjidl_core.h (include Shobjidl.h) |
| Library | Explorerframe.lib |
| DLL | Explorerframe.dll |
See also
ITaskbarList3::ThumbBarAddButtons