IInitializeWithItem::Initialize method

Initializes a handler with an IShellItem.

Syntax

HRESULT Initialize(
  IShellItem *psi,
  DWORD      grfMode
);

Parameters

psi

Type: IShellItem*

A pointer to an IShellItem.

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

   
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)