Recently, CodeGuru has published my article about customizing the Places Bar of the common file dialog. In this article I have explained how to twick the registry to display your own list of shortcuts in the places bar.
The folders are specified in registry under HKEY_CURRENT_USER in Software\Microsoft\Windows\CurrentVersion\Policies\ComDlg32\PlacesBar in two ways: either by IDs for a predefined list of folders, or by path. The name of the values must have the form PlaceX, where X is a numerical value. The key specified above does not exist by default. The operating system tries to read it and if it is find, it loads the enumerated places; if the key is missing a default list is displayed. The key affects the entire system, except for the application in the Office suite. To have a Places Bar changed only for a specific application, a temporary modification of the registry can be done, by mapping a temporary key to HKEY_CURRENT_USER with the use of RegOverridePredefKey() API. That basically implies:
- Creating a temporary key and mapping it for the HKEY_CURRENT_USER
- Putting the file dialog places there under Software\Microsoft\Windows\CurrentVersion\Policies\ComDlg32\PlacesBar
- Displaying the file dialog
- At the end, restoring the predefined HKEY_CURRENT_USER and deleting the temporary key
In the article published on CodeGuru you can read more details about this and see the code of a demo application that I created to explain how things work. The article is available at http://www.codeguru.com/cpp/misc/misc/system/article.php/c13407/.