IInitializeWithItem::Initialize method (shobjidl_core.h)

Initializes a handler with an IShellItem.

Syntax

HRESULT Initialize(
  [in] IShellItem *psi,
  [in] DWORD      grfMode
);

Parameters

[in] psi

Type: IShellItem*

A pointer to an IShellItem.

[in] grfMode

Type: DWORD

One of the following STGM values that indicate the access mode for psi.

STGM_READ

The IShellItem is read-only.

STGM_READWRITE

The IShellItem is read/write accessible.

Return value

Type: HRESULT

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

Remarks

If the IShellItem cannot be accessed, this method returns an appropriate error code.

A handler instance should be initialized only once in its lifetime. Attempts by the calling application to reinitialize the handler result in the error HRESULT_FROM_WIN32(ERROR_ALREADY_INITIALIZED).

Requirements

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