Méthode ITaskbarList3::ThumbBarSetImageList (shobjidl_core.h)

Spécifie une liste d’images qui contient des images de bouton pour une barre d’outils incorporée dans une image miniature d’une fenêtre dans un menu volant de bouton de barre des tâches.

Syntaxe

HRESULT ThumbBarSetImageList(
  [in] HWND       hwnd,
  [in] HIMAGELIST himl
);

Paramètres

[in] hwnd

Type : HWND

Handle de la fenêtre dont la représentation miniature contient la barre d’outils à mettre à jour. Ce handle doit appartenir au processus appelant.

[in] himl

Type : HIMAGELIST

Handle de la liste d’images qui contient toutes les images de bouton à utiliser dans la barre d’outils.

Valeur retournée

Type : HRESULT

Si cette méthode réussit, elle retourne S_OK. Sinon, elle retourne un code d’erreur HRESULT.

Remarques

Les applications doivent fournir les images de bouton suivantes :

  • Bouton dans son état actif par défaut.
  • Images adaptées à une utilisation avec des affichages à haut ppp (points par pouce).

Les images doivent être 32 bits et de dimensions GetSystemMetrics(SM_CXICON) x GetSystemMetrics(SM_CYICON). La barre d’outils elle-même fournit des visuels pour les états cliqués, désactivés et pointeurs d’un bouton.

Exemples

L’exemple suivant montre comment créer une barre d’outils miniature avec deux boutons dont les images proviennent d’une liste d’images.


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;
}

Configuration requise

   
Client minimal pris en charge Windows 7 [applications de bureau uniquement]
Serveur minimal pris en charge Windows Server 2008 R2 [applications de bureau uniquement]
Plateforme cible Windows
En-tête shobjidl_core.h (inclure Shobjidl.h)
Bibliothèque Explorerframe.lib
DLL Explorerframe.dll

Voir aussi

ITaskbarList

ITaskbarList2

ITaskbarList3

ITaskbarList3::ThumbBarAddButtons

ITaskbarList3::ThumbBarUpdateButtons

Extensions de la barre des tâches