Partager via


IShellFolder::CreateViewObject (Compact 2013)

3/28/2014

This method requests an object that can be used to obtain information from or interact with a folder object.

Syntax

HRESULT CreateViewObject(
  HWND hwndOwner,
  REFIID riid,
  VOID** ppvOut
);

Parameters

  • hwndOwner
    [in] Handle to the owner window. If you have implemented a custom folder view object, your folder view window should be created as a child of hwndOwner.
  • riid
    [in] Identifier of the requested interface.
  • ppvOut
    [out] Address of a pointer to the requested interface.

Return Value

Returns NOERROR if successful, or an error value otherwise.

Remarks

To support this request, create an object that exposes the interface indicated by riid and return a pointer to that interface.

The primary purpose of this method is to provide Windows Explorer with the folder object's folder view object. Windows Explorer requests a folder view object by setting riid to IID_IShellView. The folder view object displays the contents of the folder in the Windows Explorer folder view. The folder view object must be independent of the shell folder object because Windows Explorer may call this method more than once to create multiple folder view objects. A new view object must be created each time this method is called. Your folder object can respond in one of two ways to this request. It can:

  • Create a custom folder view object and return a pointer to its IShellView interface.
  • Create a system folder view object and return a pointer to its IShellView interface.

This method is also used to request objects that expose one of several optional interfaces, including IContextMenu or IExtractIcon. In this context, IShellFolder::CreateViewObject is similar in use to IShellFolder::GetUIObjectOf. However, you call IShellFolder::GetUIObjectOf to request an object for one of the items contained by a folder. Call IShellFolder::CreateViewObject to request an object for the folder itself.

Requirements

Header

shobjidl.h,
shobjidl.idl

Library

Developer Implemented

See Also

Reference

IShellFolder
IShellFolder::GetUIObjectOf