Share via


Méthode IShellLibrary::RemoveFolder (shobjidl_core.h)

Supprime un dossier de la bibliothèque.

Syntaxe

HRESULT RemoveFolder(
  [in] IShellItem *psiLocation
);

Paramètres

[in] psiLocation

Type : IShellItem*

Objet IShellItem qui représente le dossier à supprimer.

Valeur retournée

Type : HRESULT

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

Remarques

Pour des raisons pratiques, SHRemoveFolderPathFromLibrary peut être utilisé à la place de cette méthode.

Exemples

L’exemple de code suivant montre la fonction d’assistance SHRemoveFolderPathFromLibrary, qui encapsule cette méthode.

//
// from shobjidl.h
//
__inline HRESULT SHRemoveFolderPathFromLibrary(
    __in IShellLibrary *plib,
    __in PCWSTR pszFolderPath)
{
    PIDLIST_ABSOLUTE pidlFolder = 
      SHSimpleIDListFromPath (pszFolderPath);
    HRESULT hr = pidlFolder ? S_OK : E_INVALIDARG;

    if (SUCCEEDED(hr))
    {
        IShellItem *psiFolder;
        hr = SHCreateItemFromIDList (
          pidlFolder, 
          IID_PPV_ARGS(&psiFolder));

        if (SUCCEEDED(hr))
        {
            hr = plib->RemoveFolder(psiFolder);
            psiFolder->Release();
        }
        CoTaskMemFree(pidlFolder);
    }
    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)

Voir aussi

IShellLibrary

IShellLibrary::AddFolder

IShellLibrary::LoadLibraryFromItem

IShellLibrary::LoadLibraryFromKnownFolder

SHAddFolderPathToLibrary

SHLoadLibraryFromItem

SHLoadLibraryFromKnownFolder

SHLoadLibraryFromParsingName

SHRemoveFolderPathFromLibrary

Bibliothèques Windows