Share via


Metodo ITaskbarList3::ThumbBarSetImageList (shobjidl_core.h)

Specifica un elenco di immagini che contiene immagini pulsante per una barra degli strumenti incorporata in un'immagine di anteprima di una finestra in un riquadro a comparsa del pulsante della barra delle applicazioni.

Sintassi

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

Parametri

[in] hwnd

Tipo: HWND

Handle della finestra la cui rappresentazione di anteprima contiene la barra degli strumenti da aggiornare. Questo handle deve appartenere al processo di chiamata.

[in] himl

Tipo: HIMAGELIST

Handle dell'elenco di immagini che contiene tutte le immagini del pulsante da usare nella barra degli strumenti.

Valore restituito

Tipo: HRESULT

Se questo metodo ha esito positivo, restituisce S_OK. In caso contrario, restituisce un codice di errore HRESULT .

Commenti

Le applicazioni devono fornire queste immagini di pulsante:

  • Pulsante nello stato attivo predefinito.
  • Immagini adatte per l'uso con display con valori dpi elevati (punti per pollice).

Le immagini devono essere a 32 bit e di dimensioni GetSystemMetrics(SM_CXICON) x GetSystemMetrics(SM_CYICON). La barra degli strumenti fornisce oggetti visivi per gli stati clic, disabilitati e del puntatore del mouse di un pulsante.

Esempio

Nell'esempio seguente viene illustrato come creare una barra degli strumenti di anteprima con due pulsanti le cui immagini provengono da un elenco di immagini.


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

Requisiti

   
Client minimo supportato Windows 7 [solo app desktop]
Server minimo supportato Windows Server 2008 R2 [solo app desktop]
Piattaforma di destinazione Windows
Intestazione shobjidl_core.h (include Shobjidl.h)
Libreria Explorerframe.lib
DLL Explorerframe.dll

Vedi anche

ITaskbarList

ITaskbarList2

ITaskbarList3

ITaskbarList3::ThumbBarAddButtons

ITaskbarList3::ThumbBarUpdateButtons

Estensioni della barra delle applicazioni