SHLoadLibraryFromItem function (shobjidl_core.h)

Creates and loads an IShellLibrary object from a specified library definition file.

Syntax

HRESULT SHLoadLibraryFromItem(
  [in]  IShellItem *psiLibrary,
  [in]  DWORD      grfMode,
  [in]  REFIID     riid,
  [out] void       **ppv
);

Parameters

[in] psiLibrary

Type: IShellItem*

An IShellItem object for the library definition file to load.

[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 usage remarks.)

[out] ppv

Type: void**

Receives the loaded IShellLibrary object. (See usage remarks.)

Return value

Type: HRESULT

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

Remarks

Usage

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

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

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

IShellItem

IShellLibrary

IShellLibrary::LoadLibraryFromItem

IShellLibrary::LoadLibraryFromKnownFolder

SHCreateItemWithParent

SHCreateLibrary

SHGetItemFromObject

SHLoadLibraryFromKnownFolder

SHLoadLibraryFromParsingName