Visual Basic Code of the Week (COTW)
http://www.codeoftheweek.com
Issue #64
Online Version at http://www.codeoftheweek.com/membersonly/bi/0064.html (paid subscribers only)
All content and source code is Copyright (c) 1998 by C&D Programming Corp. No part of this issue can be reprinted or distributed in any manner without express written permission of C&D Programming Corp.

Product Information

Check out http://www.codeoftheweek.com/powerfindpro for a great time-saving add-in for Visual Basic.

Late breaking information

View back issues of Code of the Week online at http://www.codeoftheweek.com/issues

See our web site http://www.codeoftheweek.com/links/specialoffer.html for an exciting subscription offer. You do not want to miss this one.

In this Issue

This issue was designed for VB 4.0 32-bit and up. Questions? Email us at questions@codeoftheweek.com.

The complete source code appears near the end of this issue. Be sure not to miss it!

This issue is an enhancement to issue number 24. This issue enhances the cRegistryUtils class by adding the ability to get information about the Explorer shell folders.

cRegistryUtils

The function added to cRegistryUtils is called ShellFolderPath. All the rest of the functions included in the cRegistryUtils class are documented in Issue #24 - http://www.codeoftheweek.com/issues/0024.html

The Explorer shell folders are various system folders that contain items like the Programs folder on the Start Menu, Favorites shortcuts and the location of the My Documents folder. You can use this shell folder information to enhance your system by adding your own icons to the Send To menu or removing items from the Recently use listing. Some useful shell folders are:

Functions

There is one new function called ShellFolderPath.

Public Function ShellFolderPath(sFolderName As String) As Variant

Parameters

Returns

Returns the actual pathname of the Explorer shell folder name (see some of the examples in the Sample Usage section below). If an error occurs a value of Empty will be returned.

Sample Usage

Below is an example of how this function works.

    Dim Reg As New cRegistryUtils

    Debug.Print Reg.ShellFolderPath("SendTo")
    ' on this system the above line printed out: C:\WINDOWS\SendTo
    Debug.Print Reg.ShellFolderPath("Cache")
    ' on this system the above line printed out: C:\WINDOWS\Temporary Internet Files
    Debug.Print Reg.ShellFolderPath("Personal")
    ' on this system the above line printed out: C:\My Documents

Source Code

To see the source code for this issue you must be a subscriber to Code of the Week. If you are a subscriber the source code is available at the following address: http://www.codeoftheweek.com/membersonly/bi/0064.html


This document is available on the web

Paid subscribers can view this issue in HTML format. There is no additional source or information in the HTML formatted document. It just looks a little better since we have included some HTML formatting. Just point your browser to link at the top of this document.

Other links

Contact Information

C&D Programming Corp.
PO Box 20128
Floral Park, NY 11002-0128
Phone or Fax: (212) 504-7945
Email: info@codeoftheweek.com
Web: http://www.codeoftheweek.com