Return the path of special folders.
$ = App.scCommonStartMenu
$ = App.scCommonPrograms
$ = App.scStartMenu
$ = App.scPrograms
$ = App.scSpecialDir(csidl%)
scCommonStartMenu returns the file system directory that contains the programs and folders that appear on the Start menu for all users (CSIDL_COMMON_STARTMENU).
scCommonPrograms returns the file system directory that contains the directories for the common program groups that appear on the Start menu for all users (CSIDL_COMMON_PROGRAMS).
scStartMenu returns the file system directory that corresponds to the user's Startup program group. The system starts these programs whenever any user logs onto Windows NT or starts Windows 95 (CSIDL_STARTMENU).
scPrograms returns the file system directory that contains the user's program groups, which are also file system directories (CSIDL_PROGRAMS).
scSpecialDir(csidl%) returns the file system directory name for the special folders for the current user.
n | Constant | Directory |
---|---|---|
0 | CSIDL_DESKTOP | \Documents and Settings\User\Desktop |
2 | CSIDL_PROGRAMS | \Documents and Settings\User\Menu Start\Programs (scPrograms) |
5 | CSIDL_PERSONAL | \Documents and Settings\User\My Documents |
6 | CSIDL_FAVORITES | \Documents and Settings\User\Favourites |
7 | CSIDL_STARTUP | \Documents and Settings\User\Menu Start\Programs\Start Up |
8 | CSIDL_RECENT | \Documents and Settings\User\Recently Opened |
9 | CSIDL_SENDTO | \Documents and Settings\User\SendTo |
11 | CSIDL_STARTMENU | \Documents and Settings\User\Menu Start (scStartMenu) |
16 | CSIDL_DESKTOPDIRECTORY | \Documents and Settings\User\Desktop |
19 | CSIDL_NETHOOD | \Documents and Settings\User\NetHood |
20 | CSIDL_FONTS | \Windows\Fonts |
21 | CSIDL_TEMPLATES | \Documents and Settings\User\Templates |
26 | CSIDL_APPDATA | \Documents and Settings\User\Application Data |
27 | CSIDL_PRINTHOOD | \Documents and Settings\User\Networkprinters |
32 | CSIDL_INTERNET_CACHE | \Documents and Settings\User\Local Settings\Temporary Internet Files |
33 | CSIDL_COOKIES | \Documents and Settings\User\Cookies |
34 | CSIDL_HISTORY | \Documents and Settings\User\Local Settings\History |
35 | CSIDL_COMMON_APPDATA | \Documents and Settings\All Users\Application Data |
36 | CSIDL_WINDOWS | \Windows (WinDir$) |
37 | CSIDL_SYSTEM | \Windows\System32 (SysDir$) |
38 | CSIDL_PROGRAM_FILES | \Program Files |
39 | CSIDL_MYPICTURES | \Documents and Settings\User\My Documents\My Pictures |
43 | CSIDL_PROGRAM_FILES_COMMON | \Program Files\Common Files |
32768 | CSIDL_FLAG_CREATE | \Documents and Settings\User\Desktop |
47 | CSIDL_COMMON_ADMINTOOLS | \Documents and Settings\All Users\Menu Start\Programs\Accessories\Admin |
48 | CSIDL_ADMINTOOLS | \Documents and Settings\User\Menu Start\Programs\Admin |
Debug.Show
Trace App.scSpecialDir(CSIDL_DESKTOP)
Trace App.scSpecialDir(CSIDL_INTERNET)
Trace App.scSpecialDir(CSIDL_PROGRAMS)
Trace App.scSpecialDir(CSIDL_CONTROLS)
Trace App.scSpecialDir(CSIDL_PRINTERS)
Trace App.scSpecialDir(CSIDL_PERSONAL)
Trace App.scSpecialDir(CSIDL_FAVORITES)
Trace App.scSpecialDir(CSIDL_STARTUP)
Trace App.scSpecialDir(CSIDL_RECENT)
Trace App.scSpecialDir(CSIDL_SENDTO)
Trace App.scSpecialDir(CSIDL_BITBUCKET)
Trace App.scSpecialDir(CSIDL_STARTMENU)
Trace App.scSpecialDir(CSIDL_DESKTOPDIRECTORY)
Trace App.scSpecialDir(CSIDL_DRIVES)
Trace App.scSpecialDir(CSIDL_NETWORK)
Trace App.scSpecialDir(CSIDL_NETHOOD)
Trace App.scSpecialDir(CSIDL_FONTS)
Trace App.scSpecialDir(CSIDL_TEMPLATES)
Trace App.scSpecialDir(CSIDL_COMMON_STARTMENU)
Trace App.scSpecialDir(CSIDL_COMMON_PROGRAMS)
Trace App.scSpecialDir(CSIDL_COMMON_STARTUP)
Trace App.scSpecialDir(CSIDL_COMMON_DESKTOPDIRECTORY)
Trace App.scSpecialDir(CSIDL_APPDATA)
Trace App.scSpecialDir(CSIDL_PRINTHOOD)
Trace App.scSpecialDir(CSIDL_ALTSTARTUP)
Trace App.scSpecialDir(CSIDL_COMMON_ALTSTARTUP)
Trace App.scSpecialDir(CSIDL_COMMON_FAVORITES)
Trace App.scSpecialDir(CSIDL_INTERNET_CACHE)
Trace App.scSpecialDir(CSIDL_COOKIES)
Trace App.scSpecialDir(CSIDL_HISTORY)
Debug.Print
Trace App.scPrograms // CSIDL_PROGRAMS
Trace App.scStartMenu // CSIDL_STARTMENU
Do
Sleep
Until Me Is Nothing
Sub CSIDL
Global Const CSIDL_DESKTOP = 0x0000
Global Const CSIDL_INTERNET = 0x0001
Global Const CSIDL_PROGRAMS = 0x0002
Global Const CSIDL_CONTROLS = 0x0003
Global Const CSIDL_PRINTERS = 0x0004
Global Const CSIDL_PERSONAL = 0x0005
Global Const CSIDL_FAVORITES = 0x0006
Global Const CSIDL_STARTUP = 0x0007
Global Const CSIDL_RECENT = 0x0008
Global Const CSIDL_SENDTO = 0x0009
Global Const CSIDL_BITBUCKET = 0x000a
Global Const CSIDL_STARTMENU = 0x000b
Global Const CSIDL_DESKTOPDIRECTORY = 0x0010
Global Const CSIDL_DRIVES = 0x0011
Global Const CSIDL_NETWORK = 0x0012
Global Const CSIDL_NETHOOD = 0x0013
Global Const CSIDL_FONTS = 0x0014
Global Const CSIDL_TEMPLATES = 0x0015
Global Const CSIDL_COMMON_STARTMENU = 0x0016
Global Const CSIDL_COMMON_PROGRAMS = 0X0017
Global Const CSIDL_COMMON_STARTUP = 0x0018
Global Const CSIDL_COMMON_DESKTOPDIRECTORY = 0x0019
Global Const CSIDL_APPDATA = 0x001a
Global Const CSIDL_PRINTHOOD = 0x001b
Global Const CSIDL_ALTSTARTUP = 0x001d // DBCS
Global Const CSIDL_COMMON_ALTSTARTUP = 0x001e // DBCS
Global Const CSIDL_COMMON_FAVORITES = 0x001f
Global Const CSIDL_INTERNET_CACHE = 0x0020
Global Const CSIDL_COOKIES = 0x0021
Global Const CSIDL_HISTORY = 0x0022
scSpecialDir doesn't return the path for all CSIDL constants. For those not supported, an API call must be invoked.
Dim Path$ = Space(260)
If SHGetFolderPath(0, csidl%, 0, 0, Path$) = 0
Path$ = ZTrim(Path$)
EndIf
Declare Function SHGetFolderPath Lib "shell32.dll" Alias "SHGetFolderPathA" (ByVal hwnd As Long, ByVal csidl As Long, ByVal hToken As Long, ByVal dwFlags As Long, ByVal pszPath As String) As Long
{Created by Sjouke Hamstra; Last updated: 05/07/2023 by James Gaite}