Organize My Data Libraries in Windows 7


This article was sent to us by: Flora P. at 01282010

1 Windows 7 » Organize My Data Libraries in Windows 7
Bookmark and Share

This article details the new functionality offered by Windows 7 Libraries. We’ll review the Windows Explorer changes that promote the new user experience that Libraries offer; then we’ll explore the underlying architecture supporting Libraries.

First, we’ll look at the Windows Shell and Windows Explorer to better understand the important role that Libraries play in the new user experience. Then we’ll dive deep into the new concept of Libraries and review how Libraries work and integrate with Windows Explorer. We’ll also take a look at the native Library API and learn how to use it to work with Libraries, as well as review a few managed code samples.

Windows Explorer

To better understand the concept of Libraries in Windows 7, we need to look back to the time before Windows 7. Since the early days of Windows, Windows Explorer has been recognized by users as the main entry point into Windows. It’s the main user interface through which users can manage their files, navigate the folder hierarchy, and work with their content. Windows Explorer also enables users to manage their computers, with shortcuts such as Control Panel and My Computer provided directly from Windows Explorer.

The last major update to Windows Explorer was introduced in the Windows Vista timeframe to reflect changes in the user profile storage system that were required to handle large volumes of users’ files. However, that update was simply not enough because in the last couple of years we have witnessed a massive explosion of digital information, and with the ever-growing availability of cheap storage space, users tend to accumulate a lot of “stuff” on their computers. What we refer to as “stuff” is generally files such as digital images, video files, and all sorts of documents.

Prior to Windows 7, users had to store and organize their files within a hierarchical folder structure. To help manifest that approach, earlier versions of Windows, such as Windows XP, used the Constant Special Item ID List (CSIDL). The CSIDL values provide a systemindependent way to identify special folders used frequently by applications. Windows Vista introduced a new storage scenario and a new user profile namespace called the “Known Folders ID system” that replaced CSIDL values with Known Folder IDs, where a KNOWNFOLDERID constant identifies a special folder.

The user’s Known Folders are part of his profile and therefore are protected from other users. A user profile (or simply profile when used in this context) is a collection of data associated with a specific user. It is a digital representation of a person's identity and data, including that user’s Known Folders. For example, the My Music folder can be found under %USERPROFILE%\My Documents\My Music, where %USERPROFILE% translates to the physical location of the user profile on the computer’s hard drive. The default location is c:\users\UserName\My Documents\, where UserName is the user login ID, also known as the user account ID. Later, we’ll discuss how Windows 7 Libraries interact with Windows Vista Known Folders, because Windows 7 contains both the My Music folder as well as the Music Library. (The Known Folders introduced in Windows Vista still exist and are in use in Windows 7.)

Windows Vista automatically indexes the user’s entire Known Folders content to achieve better search optimization. Even so, users commonly store their data files in their Known Folders as well as all over the PC, in various locations such as c:\temp, d:\my work folder, or even on a network share. Storing data outside the user’s profile storage space affects the indexing and therefore the entire search experience, making files less discoverable. When a user stores data files all over the PC, it’s harder for her to find that one document she needs to work on at any given time, because she might have forgotten the specific folder in which the document is stored. Windows Search might not find that file, or it might take a while to do so if the folder in which that content is stored is not automatically indexed. And when you think about all the shared network folders an integral part of where users store data the story really gets complicated.

Known Folder ID

To support the Known Folders system, Windows Vista includes a set of KNOWNFOLDERID constants, a list of GUIDs that identify standard folders registered with the system as Known Folders. Among them, you can find the expected standard user profile folders, such as Pictures, represented by the FOLDERID_Pictures constant, and Music, represented by the FOLDERID_Music constant. But there are additional Known Folders where users can store data, such as Video, Downloads, and Favorites.

There are even Known Folders that users might not acknowledge as being part of their profiles such as Desktop, Links, and Start Menu. The list of Known Folders is long and includes Program Files, Quick Launch, and Recent Items Desktop. However, these are part of the system’s, rather than the user’s, Known Folders. Standard users, without administrative rights, don’t have write permission to any of the system Known Folders.

Let’s review the structure of one KNOWNFOLDERID constant. Each constant includes properties, such as GUID, display name, folder type, and default path.

Windows 7 introduces several new FOLDERIDs

Among them you can find the Libraries Known Folder IDs, represented by FOLDERID_Libraries, which facilitate the new Libraries’ functionality. For example, the FOLDERID_PicturesLibrary is the new FOLDERID supporting the Pictures library. The PicturesLibrary FOLDERID contains only a GUID property, whereas the rest of the properties are empty. This demonstrates that libraries are not regular folders and are just abstract definition.

The KNOWNFOLDERID constants for the default libraries include the following:

  • FOLDERID_DocumentsLibrary
  • FOLDERID_PicturesLibrary
  • FOLDERID_MusicLibrary
  • FOLDERID_RecordedTVLibrary
  • FOLDERID_VideosLibrary

All FOLDERID values are defined in Knownfolders.h and can be found in the Windows 7 Software Development Kit.

Legal Disclaimer

Webworldarticles.com is not responsible for the information contained by this article as well for any and all copyright infringements by authors and writers. Webworldarticles.com is a free information resource. If you suspect this article for any copyright infringement, please read the terms of service and contact us to investigate the problem.

Related Articles

1. Windows 7 file system FAT32 and NTFS comparison
Choosing a File System Whether you’re setting up a new disk or reformatting an existing one, the process of formatting e...

2. Creating a Performance Counter Log in Windows 7
To create a performance counter log, follow these steps: 1. Open Performance Monitor, and navigate to the Data Collector Sets node in the tree...

3. Performance of Windows 7 and Notebooks
Rediscover the Fundamentals: It’s All About Performance The single most important request customers have had about the next release of...

4. Use the Pan Gesture to Move an Object
With the pan gesture, you can control the scrolling of content in a scrollable area. Or you can apply the pan gesture to a specific object, moving it ...

5. Handling the WM GESTURE Message
To work with gestures, you’ll need to handle the WM_GESTURE messages that are sent to your application. If you are a Win32 programmer, you can c...

6. How Multitouch Works in Windows 7
New hardware and API elements in the Windows 7 operating system provide applications the ability to receive and handle touch and multitouch input. Thi...

7. Changes Made to Windows Explorer in Windows 7
Changes Made to Windows Explorer in Windows 7 In Windows 7, Libraries address the problem of users’ data being stored all over the PC by...