ICategoryProvider::GetDefaultCategory method (shobjidl_core.h)

Enables the folder to override the default grouping.

Syntax

HRESULT GetDefaultCategory(
  [out] GUID       *pguid,
  [out] SHCOLUMNID *pscid
);

Parameters

[out] pguid

Type: GUID*

Not used.

[out] pscid

Type: SHCOLUMNID*

When this method returns, contains a pointer to a SHCOLUMNID structure.

Return value

Type: HRESULT

Returns S_OK if successful, or an error value otherwise, including the following:

Return code Description
S_FALSE
There is no default group.

Remarks

ICategoryProvider::GetDefaultCategory returns an SHCOLUMNID structure that is used by the default categorizer. The method returns S_FALSE if a default group is not supported.

ICategoryProvider::GetDefaultCategory is called only when a folder is first opened. After that, the user's grouping choice is cached in the property bag storing the state of the view. To force a call to ICategoryProvider::GetDefaultCategory after the folder is first opened, the Shell and ShellNoRoam registry keys must be deleted. They are found in the following location.

HKEY_CURRENT_USER
   Software
      Microsoft
         Windows
            Shell
            ShellNoRoam

Requirements

Requirement Value
Minimum supported client 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