Share via


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

Charge la bibliothèque référencée par un KNOWNFOLDERID.

Syntaxe

HRESULT LoadLibraryFromKnownFolder(
  [in] REFKNOWNFOLDERID kfidLibrary,
  [in] DWORD            grfMode
);

Paramètres

[in] kfidLibrary

Type : REFKNOWNFOLDERID

Valeur KNOWNFOLDERID qui identifie la bibliothèque à charger.

[in] grfMode

Type : DWORD

Un ou plusieurs indicateurs de support de stockage STGM qui spécifient des modes d’accès et de partage pour l’objet de bibliothèque.

Valeur retournée

Type : HRESULT

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

Remarques

Si l’objet IShellLibrary contient une bibliothèque lorsque cette méthode est appelée, cette bibliothèque est remplacée en mémoire par la nouvelle bibliothèque.

S’il n’existe aucun objet IShellLibrary pour cette bibliothèque, SHLoadLibraryFromItem peut être appelé à la place de cette méthode.

Exemples

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

//
// from shobjidl.h
//
__inline HRESULT SHLoadLibraryFromKnownFolder(
    __in REFKNOWNFOLDERID kfidLibrary, 
    __in DWORD grfMode, 
    __in REFIID riid, 
    __deref_out void **ppv)
{
    *ppv = NULL;
    IShellLibrary *plib;
    HRESULT hr = CoCreateInstance( 
        CLSID_ShellLibrary,
        NULL,
        CLSCTX_INPROC_SERVER,
        IID_PPV_ARGS(&plib));
    if (SUCCEEDED(hr))
    {
        hr = plib->LoadLibraryFromKnownFolder(kfidLibrary, grfMode);
        if (SUCCEEDED(hr))
        {
            hr = plib->QueryInterface(riid, ppv);
        }
        plib->Release();
    }
    return hr;}

Configuration requise

Condition requise Valeur
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 ::LoadLibraryFromItem

SHCreateLibrary

SHLoadLibraryFromItem

SHLoadLibraryFromKnownFolder

SHLoadLibraryFromParsingName

Bibliothèques Windows