IShellFolderView::Rearrange method (shlobj_core.h)
[Rearrange is available for use in the operating systems specified in the Requirements section. It may be altered or unavailable in subsequent versions. Instead, use GetSortColumns.]
Rearranges the items in a view according to a sorting rule.
Syntax
HRESULT Rearrange(
[in] LPARAM lParamSort
);
Parameters
[in] lParamSort
Type: LPARAM
Specifies how the rearrangement should be performed.
The lower sixteen bits of lParamSort define the sorting rule. Most applications set the sorting rule to the default value of zero, indicating that the items should be sorted by name. The system does not define any other sorting rules. Some folder objects might allow calling applications to use the lower sixteen bits of lParamSort to specify folder-specific sorting rules. The rules and their associated lParamSort values are defined by the folder.
When the system folder view object calls IShellFolderView::Rearrange, the lower sixteen bits of lParamSort are used to specify the column to be used for the arranging.
The upper sixteen bits of lParamSort are used for flags that modify the sorting rule. The system currently defines the following modifier flags.
SHCIDS_ALLFIELDS
Version 5.0. Arrange all the information contained in the ITEMIDLIST structure, not just the display names. This flag is valid only for folder objects that support the IShellFolder2 interface. For instance, if the two items are files, the folder should arrange their names, sizes, file times, attributes, and any other information in the structures. If this flag is set, the lower sixteen bits of lParamSort must be zero.
SHCIDS_CANONICALONLY
Version 5.0. When arranging by name, arrange the system names but not the display names. When this flag is passed, the two items are arranged by whatever criteria the Shell folder determines most efficient, as long as it implements a consistent sort function. This flag cannot be combined with other flags.
Return value
Type: HRESULT
If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
Remarks
Note to Calling Applications
Do not set the SHCIDS_ALLFIELDS flag in lParamSort if the folder object does not support IShellFolder2. Doing so might have unpredictable results. If you use the SHCIDS_ALLFIELDS flag, the lower sixteen bits of lParamSort must be set to zero.Note to Implementers
To extract the sorting rule, use a bitwise AND operator (&) to combine lParamSort with SHCIDS_COLUMNMASK (0X0000FFFF). This operation masks off the upper sixteen bits of lParamSort, including the SHCIDS_ALLFIELDS value.Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows XP [desktop apps only] |
Minimum supported server | Windows Server 2003 [desktop apps only] |
Target Platform | Windows |
Header | shlobj_core.h |