SHLoadLibraryFromKnownFolder function (shobjidl_core.h)

Creates and loads an IShellLibrary object for a specified known folder ID.

Syntax

HRESULT SHLoadLibraryFromKnownFolder(
  [in]  REFKNOWNFOLDERID kfidLibrary,
  [in]  DWORD            grfMode,
  [in]  REFIID           riid,
  [out] void             **ppv
);

Parameters

[in] kfidLibrary

Type: REFKNOWNFOLDERID

The KNOWNFOLDERID value that identifies the known folder to load into the IShellLibrary object.

[in] grfMode

Type: DWORD

One or more storage medium flags that specify access and sharing modes for the library object. Commonly specified flags are STGM_READ or STGM_READWRITE. For more information, see STGM.

[in] riid

Type: REFIID

The IID for IShellLibrary. (See Remarks for more information.)

[out] ppv

Type: void**

When this function returns successfully, receives the loaded IShellLibrary object. (See Remarks for more information.)

Return value

Type: HRESULT

If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

This is an inline helper function that wraps the IShellLibrary::LoadLibraryFromKnownFolder method.

Usage

The IID_PPV_ARGS macro is generally used to generate the riid and ppv parameters for this function. For an example, see SHCreateLibrary.

Requirements

Requirement Value
Minimum supported client Windows 7 [desktop apps only]
Minimum supported server Windows Server 2008 R2 [desktop apps only]
Target Platform Windows
Header shobjidl_core.h (include Shobjidl.h)

See also

IShellLibrary

IShellLibrary::LoadLibraryFromItem

IShellLibrary::LoadLibraryFromKnownFolder

Known Folders Sample

SHCreateLibrary

SHLoadLibraryFromItem

SHLoadLibraryFromParsingName