Article ID: 252652 - Last Review: August 27, 2007 - Revision: 2.6 How To Use the SHGetFolderPath Function from Visual Basic
This article was previously published under Q252652 On This PageSUMMARY
You can use the SHGetFolderPath function to get the path to Microsoft Windows special folders, which are identified by their CSIDL value. This article includes a code example on using the SHGetFolderPath function from Microsoft Visual Basic to get the path of the logged-in user's Application Data folder. A typical path for this folder might be:
C:\Winnt\Profiles\Broder\Local Settings\Application Data
MORE INFORMATIONSHGetFolderPath is a new API function for Windows 2000. If you are not running Windows 2000, then the SHGetFolderPath function requires that you redistribute the SHFolder.dll file. The SHFolder.dll file is freely redistributable and can be obtained from the latest Platform Software Development Kit (SDK), which is available from the following Web site:
http://www.microsoft.com/msdownload/platformsdk/sdkupdate/downlevel.htm
(http://www.microsoft.com/msdownload/platformsdk/sdkupdate/downlevel.htm)
Because the location of special folders can change from system to system, Microsoft recommends that you use the SHGetFolderPath function to determine the path for a special folder. For example, you might want to determine the user's Application Data folder to store user-specific data for your application. You can determine this at run time using the SHGetFolderPath function. Please refer to the MSDN documentation to determine which folders are supported by the SHGetFolderPath function. As an alternative, if you set a reference to Microsoft Scripting Runtime in the References dialog box, you can use the FileSystemObject's GetSpecialFolder method to obtain the locations of special folders. Step-by-Step Example
REFERENCESMSDN Documentation on SHGetFolderPath For additional information, click the article number below
to view the article in the Microsoft Knowledge Base:
227051
(http://support.microsoft.com/kb/227051/EN-US/
)
How To Determine the Location of Files or Folders on Windows 2000
APPLIES TO
| Other Resources Other Support Sites
CommunityGet Help NowArticle Translations |






Windows Live
Facebook
Twitter
Linkedin
Digg it
Yahoo
Delicious
StumbleUpon
Yammer
Reddit
Technorati
FriendFeed
Email
Back to the top
