ITaskbarList3::ThumbBarSetImageList method

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

hwnd [in]

Type: HWND

The handle of the window whose thumbnail representation contains the toolbar to be updated. This handle must belong to the calling process.

himl [in]

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.

Examples

The following example shows how to create a thumbnail toolbar with two buttons whose images come from an image list.



HRESULT AddThumbarButtons(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;
    
    THUMBBUTON 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

Minimum supported client

Windows 7 [desktop apps only]

Minimum supported server

Windows Server 2008 R2 [desktop apps only]

Header

Shobjidl.h

IDL

Shobjidl.idl

Library

Explorerframe.lib

DLL

Explorerframe.dll

See also

ITaskbarList
ITaskbarList2
ITaskbarList3
ITaskbarList3::ThumbBarAddButtons
ITaskbarList3::ThumbBarUpdateButtons
Taskbar Extensions

 

 

Community Additions

ADD
Show:
© 2014 Microsoft