IShellFolder2::GetDefaultColumn method (shobjidl_core.h)

Gets the default sorting and display columns.

Syntax

HRESULT GetDefaultColumn(
  [in]  DWORD dwRes,
  [out] ULONG *pSort,
  [out] ULONG *pDisplay
);

Parameters

[in] dwRes

Type: DWORD

Reserved. Set to zero.

[out] pSort

Type: ULONG*

A pointer to a value that receives the index of the default sorted column.

[out] pDisplay

Type: ULONG*

A pointer to a value that receives the index of the default display column.

Return value

Type: HRESULT

Returns S_OK if successful, or a COM error value otherwise.

Remarks

Notes to Users

Both column indexes returned by this method are intended for use by an application that is presenting a folder view of this folder.

The column specified by pSort is the one that should be used for sorting the items in the folder. To determine the sorting order of any pair of items, pass their PIDLs to CompareIDs. Specify the column by setting the lParam parameter of CompareIDs to the value pointed to by pSort.

If a view will display only one string to represent an item, it should be taken from the column specified by pDisplay. Pass the column index and the item's PIDL to IShellFolder2::GetDetailsOf to retrieve the string.

Notes to Implementers

This method is part of a namespace extension's folder object implementation. It is typically called by a folder view object to ask the folder object which column in Microsoft Windows Explorer Details view should be used to sort the items in the folder. For example, a folder object that represents a transaction log might set pSort to the column that displays the transaction time. The items will then be sorted by the time the transaction took place, rather than by name.

Some clients might call this method to request the index of the column with the names that should be displayed in tree view. Set pDisplay to the appropriate column index. The client will then obtain the display names by calling IShellFolder2::GetDetailsOf.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional, Windows XP [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header shobjidl_core.h (include Shobjidl.h)
DLL Shell32.dll (version 5.0 or later)