DOCUMENT:Q194702 04-AUG-1999 [foxpro] TITLE :HOWTO: Locate Windows Special Folder Locations PRODUCT :Microsoft FoxPro PROD/VER:WINDOWS:3.0,3.0b,5.0,5.0a,6.0 OPER/SYS: KEYWORDS: ====================================================================== ------------------------------------------------------------------------------- The information in this article applies to: - Microsoft Visual FoxPro for Windows, versions 3.0, 3.0b, 5.0, 5.0a, 6.0 ------------------------------------------------------------------------------- SUMMARY ======= Windows 9x and Windows NT make use of many operating system special folders. These folders represent specific locations for application data, users settings, etc. It is possible to programmatically locate these folder locations using the SHGetSpecialFolderPath API function. The following program displays the full special folder path to the Windows desktop. You can alter the program to show the full path of any of the special folders by passing the appropriate special folder constant to the SHGetSpecialFolderPath API call. This program will only run on Windows 98 or Windows 95 and Windows NT systems that are configured with the Windows Desktop Update. The Windows Desktop Update can be installed from: http://www.microsoft.com/ie MORE INFORMATION ================ Save the following code as a program and run it to display the full path of the Windows Desktop special folder: *** Define Special Folder Constants #define CSIDL_PROGRAMS 2 &&Program Groups Folder #define CSIDL_PERSONAL 5 &&Personal Documents Folder #define CSIDL_FAVORITES 6 &&Favorites Folder #define CSIDL_STARTUP 7 &&Startup Group Folder #define CSIDL_RECENT 8 &&Recently Used Documents &&Folder #define CSIDL_SENDTO 9 &&Send To Folder #define CSIDL_STARTMENU 11 &&Start Menu Folder #define CSIDL_DESKTOPDIRECTORY 16 &&Desktop Folder #define CSIDL_NETHOOD 19 &&Network Neighborhood Folder #define CSIDL_TEMPLATES 21 &&Document Templates Folder #define CSIDL_COMMON_STARTMENU 22 &&Common Start Menu Folder #define CSIDL_COMMON_PROGRAMS 23 &&Common Program Groups &&Folder #define CSIDL_COMMON_STARTUP 24 &&Common Startup Group Folder #define CSIDL_COMMON_DESKTOPDIRECTORY 25 &&Common Desktop Folder #define CSIDL_APPDATA 26 &&Application Data Folder #define CSIDL_PRINTHOOD 27 &&Printers Folder #define CSIDL_COMMON_FAVORITES 31 &&Common Favorites Folder #define CSIDL_INTERNET_CACHE 32 &&Temp. Internet Files Folder #define CSIDL_COOKIES 33 &&Cookies Folder #define CSIDL_HISTORY 34 &&History Folder *** Initialize variables cSpecialFolderPath = space(255) *** Declare API's DECLARE SHGetSpecialFolderPath IN SHELL32.DLL ; LONG hwndOwner, ; STRING @cSpecialFolderPath, ; LONG nWhichFolder *** Get Special Folder Path SHGetSpecialFolderPath(0, @cSpecialFolderPath, CSIDL_DESKTOPDIRECTORY) *** Format Special Folder Path cSpecialFolderPath=SubStr(RTrim(cSpecialFolderPath),1, ; Len(RTrim(cSpecialFolderPath))-1) *** Display Special Folder Path WAIT WINDOW cSpecialFolderPath Additional query words: kbVFP500 kbvfp300b kbvfp500a ====================================================================== Keywords : Technology : kbVFPsearch kbAudDeveloper kbVFP300 kbVFP300b kbVFP500 kbVFP600 kbVFP500a Version : WINDOWS:3.0,3.0b,5.0,5.0a,6.0 Issue type : kbhowto ============================================================================= THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY. Copyright Microsoft Corporation 1999.