Click to Rate and Give Feedback
MSDN
MSDN Library
User Interface
Windows Shell
Shell Reference
Shell Functions
 SHGetViewStatePropertyBag Function
SHGetViewStatePropertyBag Function

Retrieves a property bag in which the view state information for a folder can be stored and subsequently retrieved. The user's settings are kept for the next time the user visits the folder.

Syntax

HRESULT SHGetViewStatePropertyBag(      
    PCIDLIST_ABSOLUTE pidl,     LPCWSTR pszBagName,     DWORD dwFlags,     REFIID riid,     void **ppv );

Parameters

pidl
[in] A pointer to an item identifier list (PIDL) of the folder for which you are requesting properties. This parameter must be NULL if the SHGVSPB_ALLFOLDERS flag is passed.
pszBagName
[in] A pointer to a string that contains the name of the requested property bag.
dwFlags
[in] DWORD that specifies a combination of the following flags.
One value from the following set of flags is required.
SHGVSPB_PERUSER
Returns the per-user properties for the specified pidl.
SHGVSPB_ALLUSERS
Returns the All User properties for the specified pidl.
One value from the following set of flags is required.
SHGVSPB_PERFOLDER
Returns the property bag for the folder specified by the pidl parameter.
SHGVSPB_ALLFOLDERS
Returns the property bag that applies to all folders.
SHGVSPB_INHERIT
Returns the property bag used to provide defaults for subfolders that do not have their property bag.
The following flags are optional.
SHGVSPB_ROAM
Allows the property bag to roam. See Roaming User Profiles. This flag cannot be combined with SHGVSPB_ALLFOLDERS.
SHGVSPB_NOAUTODEFAULTS
Suppresses the search for a suitable default when the property bag cannot be found for the specified folder. By default, if SHGVSPB_INHERIT is not specified and a property bag cannot be found for the specified folder, the system searches for identically named property bags in other locations that may be able to provide default values. For example, the system searches in the ancestors of the folder to see if any of them provide a SHGVSPB_INHERIT property bag. Other places the system searches are in the user defaults and the global defaults.
The following set of flags consists of values that combine some flags listed above, and are used for brevity and convenience.
SHGVSPB_FOLDER
Combines SHGVSPB_PERUSER and SHGVSPB_PERFOLDER.
SHGVSPB_FOLDERNODEFAULTS
Combines SHGVSPB_PERUSER, SHGVSPB_PERFOLDER, and SHGVSPB_NOAUTODEFAULTS.
SHGVSPB_USERDEFAULTS
Combines SHGVSPB_PERUSER and SHGVSPB_ALLFOLDERS.
SHGVSPB_GLOBALDEFAULTS
Combines SHGVSPB_ALLUSERS and SHGVSPB_ALLFOLDERS.
riid
[in] Reference to the IID of the interface to retrieve.
ppv
[out] When this method returns, contains the interface pointer requested in riid.

Return Value

Returns S_OK if successful, or an error value otherwise.

Remarks

Note  This function is available through Microsoft Windows XP Service Pack 2 (SP2) and Windows Server 2003. It might be altered or unavailable in subsequent versions of Windows.

Critical information should not be stored in the view state property bag because the system keeps only a limited number of view states. If a folder is not visited for a long time, its view state is eventually deleted.

Function Information

Minimum DLL Versionshlwapi.dll version 5.0 or later
Custom ImplementationNo
Headershlwapi.h
Import libraryshlwapi.lib
Minimum operating systems Windows 2000
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker