Jump to content

Directory functions / 54 functions


wolf9228
 Share

Recommended Posts

#Include <Array.au3>
Const $CSIDL_DESKTOP = 0
Const $CSIDL_INTERNET = 1
Const $CSIDL_PROGRAMS = 2
Const $CSIDL_CONTROLS = 3
Const $CSIDL_PRINTERS = 4
Const $CSIDL_PERSONAL = 5
Const $CSIDL_FAVORITES = 6
Const $CSIDL_STARTUP = 7
Const $CSIDL_RECENT = 8
Const $CSIDL_SENDTO = 9
Const $CSIDL_BITBUCKET = 10
Const $CSIDL_STARTMENU = 11
Const $CSIDL_DESKTOPDIRECTORY = 16
Const $CSIDL_DRIVES = 17
Const $CSIDL_NETWORK = 18
Const $CSIDL_NETHOOD = 19
Const $CSIDL_FONTS = 20
Const $CSIDL_TEMPLATES = 21
Const $CSIDL_COMMON_STARTMENU = 22
Const $CSIDL_COMMON_PROGRAMS = 23
Const $CSIDL_COMMON_STARTUP = 24
Const $CSIDL_COMMON_DESKTOPDIRECTORY = 25
Const $CSIDL_APPDATA = 26
Const $CSIDL_PRINTHOOD = 27
Const $CSIDL_LOCAL_APPDATA = 28
Const $CSIDL_ALTSTARTUP = 29
Const $CSIDL_COMMON_ALTSTARTUP = 30
Const $CSIDL_COMMON_FAVORITES = 31
Const $CSIDL_INTERNET_CACHE = 32
Const $CSIDL_COOKIES = 33
Const $CSIDL_HISTORY = 34
Const $CSIDL_COMMON_APPDATA = 35
Const $CSIDL_WINDOWS = 36
Const $CSIDL_SYSTEM = 37
Const $CSIDL_PROGRAM_FILES = 38
Const $CSIDL_MYPICTURES = 39
Const $CSIDL_PROFILE = 40
Const $CSIDL_SYSTEMX86 = 41
Const $CSIDL_PROGRAM_FILESX86 = 42
Const $CSIDL_PROGRAM_FILES_COMMON = 43
Const $CSIDL_PROGRAM_FILES_COMMONX86 = 44
Const $CSIDL_COMMON_TEMPLATES = 45
Const $CSIDL_COMMON_DOCUMENTS = 46
Const $CSIDL_COMMON_ADMINTOOLS = 47
Const $CSIDL_ADMINTOOLS = 48
Const $CSIDL_CONNECTIONS = 49
Const $CSIDL_COMMON_MUSIC = 53
Const $CSIDL_COMMON_PICTURES = 54
Const $CSIDL_COMMON_VIDEO = 55
Const $CSIDL_RESOURCES = 56
Const $CSIDL_RESOURCES_LOCALIZED = 57
Const $CSIDL_COMMON_OEM_LINKS = 58
Const $CSIDL_CDBURN_AREA = 59
Const $CSIDL_COMPUTERSNEARME = 61
Dim $Array[55][2]
$Array[1][0] = "DESKTOP"
$Array[1][1] = DESKTOP()
$Array[2][0] = "INTERNET"
$Array[2][1] = INTERNET()
$Array[3][0] = "PROGRAMS"
$Array[3][1] = PROGRAMS()
$Array[4][0] = "CONTROLS"
$Array[4][1] = CONTROLS()
$Array[5][0] = "PRINTERS"
$Array[5][1] = PRINTERS()
$Array[6][0] = "PERSONAL"
$Array[6][1] = PERSONAL()
$Array[7][0] = "FAVORITES"
$Array[7][1] = FAVORITES()
$Array[8][0] = "STARTUP"
$Array[8][1] = STARTUP()
$Array[9][0] = "RECENT"
$Array[9][1] = RECENT()
$Array[10][0] = "SENDTO"
$Array[10][1] = SENDTO()
$Array[11][0] = "BITBUCKET"
$Array[11][1] = BITBUCKET()
$Array[12][0] = "STARTMENU"
$Array[12][1] = STARTMENU()
$Array[13][0] = "DESKTOPDIRECTORY"
$Array[13][1] = DESKTOPDIRECTORY()
$Array[14][0] = "DRIVES"
$Array[14][1] = DRIVES()
$Array[15][0] = "NETWORK"
$Array[15][1] = NETWORK()
$Array[16][0] = "NETHOOD"
$Array[16][1] = NETHOOD()
$Array[17][0] = "FONTS"
$Array[17][1] = FONTS()
$Array[18][0] = "TEMPLATES"
$Array[18][1] = TEMPLATES()
$Array[19][0] = "COMMON_STARTMENU"
$Array[19][1] = COMMON_STARTMENU()
$Array[20][0] = "COMMON_PROGRAMS"
$Array[20][1] = COMMON_PROGRAMS()
$Array[21][0] = "COMMON_STARTUP"
$Array[21][1] = COMMON_STARTUP()
$Array[22][0] = "COMMON_DESKTOPDIRECTORY"
$Array[22][1] = COMMON_DESKTOPDIRECTORY()
$Array[23][0] = "APPDATA"
$Array[23][1] = APPDATA()
$Array[24][0] = "PRINTHOOD"
$Array[24][1] = PRINTHOOD()
$Array[25][0] = "LOCAL_APPDATA"
$Array[25][1] = LOCAL_APPDATA()
$Array[26][0] = "ALTSTARTUP"
$Array[26][1] = ALTSTARTUP()
$Array[27][0] = "COMMON_ALTSTARTUP"
$Array[27][1] = COMMON_ALTSTARTUP()
$Array[28][0] = "COMMON_FAVORITES"
$Array[28][1] = COMMON_FAVORITES()
$Array[29][0] = "INTERNET_CACHE"
$Array[29][1] = INTERNET_CACHE()
$Array[30][0] = "COOKIES"
$Array[30][1] = COOKIES()
$Array[31][0] = "HISTORY"
$Array[31][1] = HISTORY()
$Array[32][0] = "COMMON_APPDATA"
$Array[32][1] = COMMON_APPDATA()
$Array[33][0] = "WINDOWS"
$Array[33][1] = WINDOWS()
$Array[34][0] = "SYSTEM"
$Array[34][1] = SYSTEM()
$Array[35][0] = "PROGRAM_FILES"
$Array[35][1] = PROGRAM_FILES()
$Array[36][0] = "MYPICTURES"
$Array[36][1] = MYPICTURES()
$Array[37][0] = "PROFILE"
$Array[37][1] = PROFILE()
$Array[38][0] = "SYSTEMX86"
$Array[38][1] = SYSTEMX86()
$Array[39][0] = "PROGRAM_FILESX86"
$Array[39][1] = PROGRAM_FILESX86()
$Array[40][0] = "PROGRAM_FILES_COMMON"
$Array[40][1] = PROGRAM_FILES_COMMON()
$Array[41][0] = "PROGRAM_FILES_COMMONX86"
$Array[41][1] = PROGRAM_FILES_COMMONX86()
$Array[42][0] = "COMMON_TEMPLATES"
$Array[42][1] = COMMON_TEMPLATES()
$Array[43][0] = "COMMON_DOCUMENTS"
$Array[43][1] = COMMON_DOCUMENTS()
$Array[44][0] = "COMMON_ADMINTOOLS"
$Array[44][1] = COMMON_ADMINTOOLS()
$Array[45][0] = "ADMINTOOLS"
$Array[45][1] = ADMINTOOLS()
$Array[46][0] = "CONNECTIONS"
$Array[46][1] = CONNECTIONS()
$Array[47][0] = "COMMON_MUSIC"
$Array[47][1] = COMMON_MUSIC()
$Array[48][0] = "COMMON_PICTURES"
$Array[48][1] = COMMON_PICTURES()
$Array[49][0] = "COMMON_VIDEO"
$Array[49][1] = COMMON_VIDEO()
$Array[50][0] = "RESOURCES"
$Array[50][1] = RESOURCES()
$Array[51][0] = "RESOURCES_LOCALIZED"
$Array[51][1] = RESOURCES_LOCALIZED()
$Array[52][0] = "COMMON_OEM_LINKS"
$Array[52][1] = COMMON_OEM_LINKS()
$Array[53][0] = "CDBURN_AREA"
$Array[53][1] = CDBURN_AREA()
$Array[54][0] = "COMPUTERSNEARME"
$Array[54][1] = COMPUTERSNEARME()


_ArrayDisplay($Array,"")
;Constants

;CSIDL_ADMINTOOLS (FOLDERID_AdminTools)
;;Version 5.0. The file system directory that is used to store administrative tools for an individual user. The Microsoft Management Console (MMC) will save customized consoles to this directory, and it will roam with the user.
;CSIDL_ALTSTARTUP (FOLDERID_Startup)
;;The file system directory that corresponds to the user's nonlocalized Startup program group. This value is recognized in Windows Vista for backward compatibility, but the folder itself no longer exists.
;CSIDL_APPDATA (FOLDERID_RoamingAppData)
;;Version 4.71. The file system directory that serves as a common repository for application-specific data. A typical path is C:\Documents and Settings\username\Application Data. This CSIDL is supported by the redistributable Shfolder.dll for systems that do not have the Microsoft Internet Explorer 4.0 integrated Shell installed.
;CSIDL_BITBUCKET (FOLDERID_RecycleBinFolder)
;;The virtual folder that contains the objects in the user's Recycle Bin.
;CSIDL_CDBURN_AREA (FOLDERID_CDBurning)
;;Version 6.0. The file system directory that acts as a staging area for files waiting to be written to a CD. A typical path is C:\Documents and Settings\username\Local Settings\Application Data\Microsoft\CD Burning.
;CSIDL_COMMON_ADMINTOOLS (FOLDERID_CommonAdminTools)
;;Version 5.0. The file system directory that contains administrative tools for all users of the computer.
;CSIDL_COMMON_ALTSTARTUP (FOLDERID_Commonstartup)
;;The file system directory that corresponds to the nonlocalized Startup program group for all users. Valid only for Microsoft Windows NT systems. This value is recognized in Windows Vista for backward compatibility, but the folder itself no longer exists.
;CSIDL_COMMON_APPDATA (FOLDERID_ProgramData)
;;Version 5.0. The file system directory that contains application data for all users. A typical path is C:\Documents and Settings\All Users\Application Data. This folder is used for application data that is not user specific. For example, an application can store a spell-check dictionary, a database of clip art, or a log file in the CSIDL_COMMON_APPDATA folder. This information will not roam and is available to anyone using the computer.
;CSIDL_COMMON_DESKTOPDIRECTORY (FOLDERID_PublicDesktop)
;;The file system directory that contains files and folders that appear on the desktop for all users. A typical path is C:\Documents and Settings\All Users\Desktop. Valid only for Windows NT systems.
;CSIDL_COMMON_DOCUMENTS (FOLDERID_PublicDocuments)
;;The file system directory that contains documents that are common to all users. A typical paths is C:\Documents and Settings\All Users\Documents. Valid for Windows NT systems and Microsoft Windows 95 and Windows 98 systems with Shfolder.dll installed.
;CSIDL_COMMON_FAVORITES (FOLDERID_Favorites)
;;The file system directory that serves as a common repository for favorite items common to all users. Valid only for Windows NT systems.
;CSIDL_COMMON_MUSIC (FOLDERID_PublicMusic)
;;Version 6.0. The file system directory that serves as a repository for music files common to all users. A typical path is C:\Documents and Settings\All Users\Documents\My Music.
;CSIDL_COMMON_OEM_LINKS (FOLDERID_CommonOEMLinks)
;;This value is recognized in Windows Vista for backward compatibility, but the folder itself is no longer used.
;CSIDL_COMMON_PICTURES (FOLDERID_PublicPictures)
;;Version 6.0. The file system directory that serves as a repository for image files common to all users. A typical path is C:\Documents and Settings\All Users\Documents\My Pictures.
;CSIDL_COMMON_PROGRAMS (FOLDERID_CommonPrograms)
;;The file system directory that contains the directories for the common program groups that appear on the Start menu for all users. A typical path is C:\Documents and Settings\All Users\Start Menu\Programs. Valid only for Windows NT systems.
;CSIDL_COMMON_STARTMENU (FOLDERID_CommonstartMenu)
;;The file system directory that contains the programs and folders that appear on the Start menu for all users. A typical path is C:\Documents and Settings\All Users\Start Menu. Valid only for Windows NT systems.
;CSIDL_COMMON_STARTUP (FOLDERID_Commonstartup)
;;The file system directory that contains the programs that appear in the Startup folder for all users. A typical path is C:\Documents and Settings\All Users\Start Menu\Programs\Startup. Valid only for Windows NT systems.
;CSIDL_COMMON_TEMPLATES (FOLDERID_CommonTemplates)
;;The file system directory that contains the templates that are available to all users. A typical path is C:\Documents and Settings\All Users\Templates. Valid only for Windows NT systems.
;CSIDL_COMMON_VIDEO (FOLDERID_PublicVideos)
;;Version 6.0. The file system directory that serves as a repository for video files common to all users. A typical path is C:\Documents and Settings\All Users\Documents\My Videos.
;CSIDL_COMPUTERSNEARME (FOLDERID_NetworkFolder)
;;The folder that represents other computers in your workgroup.
;CSIDL_CONNECTIONS (FOLDERID_ConnectionsFolder)
;;The virtual folder that represents Network Connections, that contains network and dial-up connections.
;CSIDL_CONTROLS (FOLDERID_ControlPanelFolder)
;;The virtual folder that contains icons for the Control Panel applications.
;CSIDL_COOKIES (FOLDERID_Cookies)
;;The file system directory that serves as a common repository for Internet cookies. A typical path is C:\Documents and Settings\username\Cookies.
;CSIDL_DESKTOP (FOLDERID_Desktop)
;;The virtual folder that represents the Windows desktop, the root of the namespace.
;CSIDL_DESKTOPDIRECTORY (FOLDERID_Desktop)
;;The file system directory used to physically store file objects on the desktop (not to be confused with the desktop folder itself). A typical path is C:\Documents and Settings\username\Desktop.
;CSIDL_DRIVES (FOLDERID_ComputerFolder)
;;The virtual folder that represents My Computer, containing everything on the local computer: storage devices, printers, and Control Panel. The folder can also contain mapped network drives.
;CSIDL_FAVORITES (FOLDERID_Favorites)
;;The file system directory that serves as a common repository for the user's favorite items. A typical path is C:\Documents and Settings\username\Favorites.
;CSIDL_FONTS (FOLDERID_Fonts)
;;A virtual folder that contains fonts. A typical path is C:\Windows\Fonts.
;CSIDL_HISTORY (FOLDERID_History)
;;The file system directory that serves as a common repository for Internet history items.
;CSIDL_INTERNET (FOLDERID_InternetFolder)
;;A virtual folder for Internet Explorer. 
;CSIDL_INTERNET_CACHE (FOLDERID_InternetCache)
;;Version 4.72. The file system directory that serves as a common repository for temporary Internet files. A typical path is C:\Documents and Settings\username\Local Settings\Temporary Internet Files.
;CSIDL_LOCAL_APPDATA (FOLDERID_LocalAppData)
;;Version 5.0. The file system directory that serves as a data repository for local (nonroaming) applications. A typical path is C:\Documents and Settings\username\Local Settings\Application Data.
;CSIDL_MYDOCUMENTS (FOLDERID_Documents)
;;Version 6.0. The virtual folder that represents the My Documents desktop item. This value is equivalent to CSIDL_PERSONAL.
;CSIDL_MYMUSIC (FOLDERID_Music)
;;The file system directory that serves as a common repository for music files. A typical path is C:\Documents and Settings\User\My Documents\My Music.
;CSIDL_MYPICTURES (FOLDERID_Pictures)
;;Version 5.0. The file system directory that serves as a common repository for image files. A typical path is C:\Documents and Settings\username\My Documents\My Pictures.
;CSIDL_MYVIDEO (FOLDERID_Videos)
;;Version 6.0. The file system directory that serves as a common repository for video files. A typical path is C:\Documents and Settings\username\My Documents\My Videos.
;CSIDL_NETHOOD (FOLDERID_NetHood)
;;A file system directory that contains the link objects that may exist in the My Network Places virtual folder. It is not the same as CSIDL_NETWORK, which represents the network namespace root. A typical path is C:\Documents and Settings\username\NetHood.
;CSIDL_NETWORK (FOLDERID_NetworkFolder)
;;A virtual folder that represents Network Neighborhood, the root of the network namespace hierarchy.
;CSIDL_PERSONAL (FOLDERID_Documents)
;;Version 6.0. The virtual folder that represents the My Documents desktop item. This is equivalent to CSIDL_MYDOCUMENTS.

;;Previous to Version 6.0. The file system directory used to physically store a user's common repository of documents. A typical path is C:\Documents and Settings\username\My Documents. This should be distinguished from the virtual My Documents folder in the namespace. To access that virtual folder, use SHGetFolderLocation, which returns the ITEMIDLIST for the virtual location, or refer to the technique described in Managing the File System.
;CSIDL_PRINTERS (FOLDERID_PrintersFolder)
;;The virtual folder that contains installed printers.
;CSIDL_PRINTHOOD (FOLDERID_PrintHood)
;;The file system directory that contains the link objects that can exist in the Printers virtual folder. A typical path is C:\Documents and Settings\username\PrintHood.
;CSIDL_PROFILE (FOLDERID_Profile)
;;Version 5.0. The user's profile folder. A typical path is C:\Users\username. Applications should not create files or folders at this level; they should put their data under the locations referred to by CSIDL_APPDATA or CSIDL_LOCAL_APPDATA. However, if you are creating a new Known Folder the profile root refered to by CSIDL_PROFILE is appropriate.
;CSIDL_PROGRAM_FILES (FOLDERID_ProgramFiles)
;;Version 5.0. The Program Files folder. A typical path is C:\Program Files.
;CSIDL_PROGRAM_FILESX86 (FOLDERID_ProgramFilesX86)
;CSIDL_PROGRAM_FILES_COMMON (FOLDERID_ProgramFilesCommon)
;;Version 5.0. A folder for components that are shared across applications. A typical path is C:\Program Files\Common. Valid only for Windows NT, Windows 2000, and Windows XP systems. Not valid for Windows Millennium Edition (Windows Me).
;CSIDL_PROGRAM_FILES_COMMONX86 (FOLDERID_ProgramFilesCommonX86)
;CSIDL_PROGRAMS (FOLDERID_Programs)
;;The file system directory that contains the user's program groups (which are themselves file system directories). A typical path is C:\Documents and Settings\username\Start Menu\Programs. 
;CSIDL_RECENT (FOLDERID_Recent)
;;The file system directory that contains shortcuts to the user's most recently used documents. A typical path is C:\Documents and Settings\username\My Recent Documents. To create a shortcut in this folder, use SHAddToRecentDocs. In addition to creating the shortcut, this function updates the Shell's list of recent documents and adds the shortcut to the My Recent Documents submenu of the Start menu.
;CSIDL_RESOURCES (FOLDERID_ResourceDir)
;;Windows Vista. The file system directory that contains resource data. A typical path is C:\Windows\Resources.
;CSIDL_RESOURCES_LOCALIZED (FOLDERID_LocalizedResourcesDir)
;CSIDL_SENDTO (FOLDERID_SendTo)
;;The file system directory that contains Send To menu items. A typical path is C:\Documents and Settings\username\SendTo.
;CSIDL_STARTMENU (FOLDERID_StartMenu)
;;The file system directory that contains Start menu items. A typical path is C:\Documents and Settings\username\Start Menu.
;CSIDL_STARTUP (FOLDERID_Startup)
;;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. A typical path is C:\Documents and Settings\username\Start Menu\Programs\Startup.
;CSIDL_SYSTEM (FOLDERID_System)
;;Version 5.0. The Windows System folder. A typical path is C:\Windows\System32.
;CSIDL_SYSTEMX86 (FOLDERID_SystemX86)
;CSIDL_TEMPLATES (FOLDERID_Templates)
;;The file system directory that serves as a common repository for document templates. A typical path is C:\Documents and Settings\username\Templates.
;CSIDL_WINDOWS (FOLDERID_Windows)
;;Version 5.0. The Windows directory or SYSROOT. This corresponds to the %windir% or %SYSTEMROOT% environment variables. A typical path is C:\Windows.
;Flags 
;CSIDL_FLAG_CREATE (KF_FLAG_CREATE)
;;Version 5.0. Combine with another CSIDL to force the creation of the associated folder if it does not exist.
;CSIDL_FLAG_DONT_UNEXPAND (KF_FLAG_DONT_UNEXPAND)
;;Combine with another CSIDL constant to ensure the expansion of environment variables.
;CSIDL_FLAG_DONT_VERIFY (KF_FLAG_DONT_VERIFY)
;;Combine with another CSIDL constant, except for CSIDL_FLAG_CREATE, to return an unverified folder path with no attempt to create or initialize the folder.
;CSIDL_FLAG_NO_ALIAS (KF_FLAG_NO_ALIAS)
;;Combine with another CSIDL constant to ensure the retrieval of the true system path for the folder, free of any aliased placeholders such as %USERPROFILE%, returned by SHGetFolderLocation. This flag has no effect on paths returned by SHGetFolderPath.
;CSIDL_FLAG_PER_USER_INIT 
;CSIDL_FLAG_MASK 
;;A mask for any valid CSIDL flag value.


Func DESKTOP()
Return SHGetSpecialFolderPath($CSIDL_DESKTOP)
EndFunc
Func INTERNET()
Return SHGetSpecialFolderPath($CSIDL_INTERNET)
EndFunc
Func PROGRAMS()
Return SHGetSpecialFolderPath($CSIDL_PROGRAMS)
EndFunc
Func CONTROLS()
Return SHGetSpecialFolderPath($CSIDL_CONTROLS)
EndFunc
Func PRINTERS()
Return SHGetSpecialFolderPath($CSIDL_PRINTERS)
EndFunc
Func PERSONAL()
Return SHGetSpecialFolderPath($CSIDL_PERSONAL)
EndFunc
Func FAVORITES()
Return SHGetSpecialFolderPath($CSIDL_FAVORITES)
EndFunc
Func STARTUP()
Return SHGetSpecialFolderPath($CSIDL_STARTUP)
EndFunc
Func RECENT()
Return SHGetSpecialFolderPath($CSIDL_RECENT)
EndFunc
Func SENDTO()
Return SHGetSpecialFolderPath($CSIDL_SENDTO)
EndFunc
Func BITBUCKET()
Return SHGetSpecialFolderPath($CSIDL_BITBUCKET)
EndFunc
Func STARTMENU()
Return SHGetSpecialFolderPath($CSIDL_STARTMENU)
EndFunc
Func DESKTOPDIRECTORY()
Return SHGetSpecialFolderPath($CSIDL_DESKTOPDIRECTORY)
EndFunc
Func DRIVES()
Return SHGetSpecialFolderPath($CSIDL_DRIVES)
EndFunc
Func NETWORK()
Return SHGetSpecialFolderPath($CSIDL_NETWORK)
EndFunc
Func NETHOOD()
Return SHGetSpecialFolderPath($CSIDL_NETHOOD)
EndFunc
Func FONTS()
Return SHGetSpecialFolderPath($CSIDL_FONTS)
EndFunc
Func TEMPLATES()
Return SHGetSpecialFolderPath($CSIDL_TEMPLATES)
EndFunc
Func COMMON_STARTMENU()
Return SHGetSpecialFolderPath($CSIDL_COMMON_STARTMENU)
EndFunc
Func COMMON_PROGRAMS()
Return SHGetSpecialFolderPath($CSIDL_COMMON_PROGRAMS)
EndFunc
Func COMMON_STARTUP()
Return SHGetSpecialFolderPath($CSIDL_COMMON_STARTUP)
EndFunc
Func COMMON_DESKTOPDIRECTORY()
Return SHGetSpecialFolderPath($CSIDL_COMMON_DESKTOPDIRECTORY)
EndFunc
Func APPDATA()
Return SHGetSpecialFolderPath($CSIDL_APPDATA)
EndFunc
Func PRINTHOOD()
Return SHGetSpecialFolderPath($CSIDL_PRINTHOOD)
EndFunc
Func LOCAL_APPDATA()
Return SHGetSpecialFolderPath($CSIDL_LOCAL_APPDATA)
EndFunc
Func ALTSTARTUP()
Return SHGetSpecialFolderPath($CSIDL_ALTSTARTUP)
EndFunc
Func COMMON_ALTSTARTUP()
Return SHGetSpecialFolderPath($CSIDL_COMMON_ALTSTARTUP)
EndFunc
Func COMMON_FAVORITES()
Return SHGetSpecialFolderPath($CSIDL_COMMON_FAVORITES)
EndFunc
Func INTERNET_CACHE()
Return SHGetSpecialFolderPath($CSIDL_INTERNET_CACHE)
EndFunc
Func COOKIES()
Return SHGetSpecialFolderPath($CSIDL_COOKIES)
EndFunc
Func HISTORY()
Return SHGetSpecialFolderPath($CSIDL_HISTORY)
EndFunc
Func COMMON_APPDATA()
Return SHGetSpecialFolderPath($CSIDL_COMMON_APPDATA)
EndFunc
Func WINDOWS()
Return SHGetSpecialFolderPath($CSIDL_WINDOWS)
EndFunc
Func SYSTEM()
Return SHGetSpecialFolderPath($CSIDL_SYSTEM)
EndFunc
Func PROGRAM_FILES()
Return SHGetSpecialFolderPath($CSIDL_PROGRAM_FILES)
EndFunc
Func MYPICTURES()
Return SHGetSpecialFolderPath($CSIDL_MYPICTURES)
EndFunc
Func PROFILE()
Return SHGetSpecialFolderPath($CSIDL_PROFILE)
EndFunc
Func SYSTEMX86()
Return SHGetSpecialFolderPath($CSIDL_SYSTEMX86)
EndFunc
Func PROGRAM_FILESX86()
Return SHGetSpecialFolderPath($CSIDL_PROGRAM_FILESX86)
EndFunc
Func PROGRAM_FILES_COMMON()
Return SHGetSpecialFolderPath($CSIDL_PROGRAM_FILES_COMMON)
EndFunc
Func PROGRAM_FILES_COMMONX86()
Return SHGetSpecialFolderPath($CSIDL_PROGRAM_FILES_COMMONX86)
EndFunc
Func COMMON_TEMPLATES()
Return SHGetSpecialFolderPath($CSIDL_COMMON_TEMPLATES)
EndFunc
Func COMMON_DOCUMENTS()
Return SHGetSpecialFolderPath($CSIDL_COMMON_DOCUMENTS)
EndFunc
Func COMMON_ADMINTOOLS()
Return SHGetSpecialFolderPath($CSIDL_COMMON_ADMINTOOLS)
EndFunc
Func ADMINTOOLS()
Return SHGetSpecialFolderPath($CSIDL_ADMINTOOLS)
EndFunc
Func CONNECTIONS()
Return SHGetSpecialFolderPath($CSIDL_CONNECTIONS)
EndFunc
Func COMMON_MUSIC()
Return SHGetSpecialFolderPath($CSIDL_COMMON_MUSIC)
EndFunc
Func COMMON_PICTURES()
Return SHGetSpecialFolderPath($CSIDL_COMMON_PICTURES)
EndFunc
Func COMMON_VIDEO()
Return SHGetSpecialFolderPath($CSIDL_COMMON_VIDEO)
EndFunc
Func RESOURCES()
Return SHGetSpecialFolderPath($CSIDL_RESOURCES)
EndFunc
Func RESOURCES_LOCALIZED()
Return SHGetSpecialFolderPath($CSIDL_RESOURCES_LOCALIZED)
EndFunc
Func COMMON_OEM_LINKS()
Return SHGetSpecialFolderPath($CSIDL_COMMON_OEM_LINKS)
EndFunc
Func CDBURN_AREA()
Return SHGetSpecialFolderPath($CSIDL_CDBURN_AREA)
EndFunc
Func COMPUTERSNEARME()
Return SHGetSpecialFolderPath($CSIDL_COMPUTERSNEARME)
EndFunc


Func SHGetSpecialFolderPath($csidl)
;hwndOwner
;Reserved.

;lpszPath
;[out] A pointer to a null-terminated string that receives the drive and path of the 
;specified folder. This buffer must be at least MAX_PATH characters in size.

;csidl
;[in] A CSIDL that identifies the folder of interest. If a virtual folder is specified
;, this function will fail.

;fCreate
;[in] Indicates whether the folder should be created if it does not already exist. If 
;this value is nonzero, the folder is created. If this value is zero, the folder is
;not created.
Local $hwndOwner = 0 , $lpszPath = "" , $fCreate = False , $MAX_PATH = 260
$lpszPath = DllStructCreate("char[" & $MAX_PATH & "]")
$BOOL = DllCall("shell32.dll","int","SHGetSpecialFolderPath","int",$hwndOwner,"ptr", _ 
DllStructGetPtr($lpszPath),"int",$csidl,"int",$fCreate)
if Not @error Then
Return SetError($BOOL[0],0,DllStructGetData($lpszPath,1))
Else
Return SetError(@error,0,0)
EndIf
EndFunc

Edited by wolf9228

صرح السماء كان هنا

 

Link to comment
Share on other sites

Nice.

Althought something similar has posted before (uses COM, not API): Yet another UDF to get Special folder information (_FileFindSpecialFolderEx)

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

Good learning the WinAPI material, but may be better to use the Unicode version of SHGetSpecialFolderPath function, and if an error occurs, this function returns an empty string, not zero (0)?

EDIT:

By the way, in my WinAPIEx.au3 this function is present.

:D

Edited by Yashied
Link to comment
Share on other sites

Good learning the WinAPI material, but may be better to use the Unicode version of SHGetSpecialFolderPath function, and if an error occurs, this function returns an empty string, not zero (0)?

EDIT:

By the way, in my WinAPIEx.au3 this function is present.

:D

@error macro :D

calling error code libraries

First check the results of the @error macro

This Autoit is not C++ Or language that many types of variables

Edited by wolf9228

صرح السماء كان هنا

 

Link to comment
Share on other sites

Good learning the WinAPI material, but may be better to use the Unicode version of SHGetSpecialFolderPath function, and if an error occurs, this function returns an empty string, not zero (0)?

EDIT:

By the way, in my WinAPIEx.au3 this function is present.

:D

Good learning the WinAPI material, but may be better to use the Unicode version of SHGetSpecialFolderPath function, and if an error occurs, this function returns an empty string, not zero (0)?

EDIT:

By the way, in my WinAPIEx.au3 this function is present.

:D

Look at the name of the library is incorrect

shell32.dl

$BOOL = DllCall("shell32.dl","int","SHGetSpecialFolderPath","

Now look at the Results In the Array

#Include <Array.au3>
Const $CSIDL_DESKTOP = 0
Const $CSIDL_INTERNET = 1
Const $CSIDL_PROGRAMS = 2
Const $CSIDL_CONTROLS = 3
Const $CSIDL_PRINTERS = 4
Const $CSIDL_PERSONAL = 5
Const $CSIDL_FAVORITES = 6
Const $CSIDL_STARTUP = 7
Const $CSIDL_RECENT = 8
Const $CSIDL_SENDTO = 9
Const $CSIDL_BITBUCKET = 10
Const $CSIDL_STARTMENU = 11
Const $CSIDL_DESKTOPDIRECTORY = 16
Const $CSIDL_DRIVES = 17
Const $CSIDL_NETWORK = 18
Const $CSIDL_NETHOOD = 19
Const $CSIDL_FONTS = 20
Const $CSIDL_TEMPLATES = 21
Const $CSIDL_COMMON_STARTMENU = 22
Const $CSIDL_COMMON_PROGRAMS = 23
Const $CSIDL_COMMON_STARTUP = 24
Const $CSIDL_COMMON_DESKTOPDIRECTORY = 25
Const $CSIDL_APPDATA = 26
Const $CSIDL_PRINTHOOD = 27
Const $CSIDL_LOCAL_APPDATA = 28
Const $CSIDL_ALTSTARTUP = 29
Const $CSIDL_COMMON_ALTSTARTUP = 30
Const $CSIDL_COMMON_FAVORITES = 31
Const $CSIDL_INTERNET_CACHE = 32
Const $CSIDL_COOKIES = 33
Const $CSIDL_HISTORY = 34
Const $CSIDL_COMMON_APPDATA = 35
Const $CSIDL_WINDOWS = 36
Const $CSIDL_SYSTEM = 37
Const $CSIDL_PROGRAM_FILES = 38
Const $CSIDL_MYPICTURES = 39
Const $CSIDL_PROFILE = 40
Const $CSIDL_SYSTEMX86 = 41
Const $CSIDL_PROGRAM_FILESX86 = 42
Const $CSIDL_PROGRAM_FILES_COMMON = 43
Const $CSIDL_PROGRAM_FILES_COMMONX86 = 44
Const $CSIDL_COMMON_TEMPLATES = 45
Const $CSIDL_COMMON_DOCUMENTS = 46
Const $CSIDL_COMMON_ADMINTOOLS = 47
Const $CSIDL_ADMINTOOLS = 48
Const $CSIDL_CONNECTIONS = 49
Const $CSIDL_COMMON_MUSIC = 53
Const $CSIDL_COMMON_PICTURES = 54
Const $CSIDL_COMMON_VIDEO = 55
Const $CSIDL_RESOURCES = 56
Const $CSIDL_RESOURCES_LOCALIZED = 57
Const $CSIDL_COMMON_OEM_LINKS = 58
Const $CSIDL_CDBURN_AREA = 59
Const $CSIDL_COMPUTERSNEARME = 61
Dim $Array[55][2]
$Array[1][0] = "DESKTOP"
$Array[1][1] = DESKTOP()
$Array[2][0] = "INTERNET"
$Array[2][1] = INTERNET()
$Array[3][0] = "PROGRAMS"
$Array[3][1] = PROGRAMS()
$Array[4][0] = "CONTROLS"
$Array[4][1] = CONTROLS()
$Array[5][0] = "PRINTERS"
$Array[5][1] = PRINTERS()
$Array[6][0] = "PERSONAL"
$Array[6][1] = PERSONAL()
$Array[7][0] = "FAVORITES"
$Array[7][1] = FAVORITES()
$Array[8][0] = "STARTUP"
$Array[8][1] = STARTUP()
$Array[9][0] = "RECENT"
$Array[9][1] = RECENT()
$Array[10][0] = "SENDTO"
$Array[10][1] = SENDTO()
$Array[11][0] = "BITBUCKET"
$Array[11][1] = BITBUCKET()
$Array[12][0] = "STARTMENU"
$Array[12][1] = STARTMENU()
$Array[13][0] = "DESKTOPDIRECTORY"
$Array[13][1] = DESKTOPDIRECTORY()
$Array[14][0] = "DRIVES"
$Array[14][1] = DRIVES()
$Array[15][0] = "NETWORK"
$Array[15][1] = NETWORK()
$Array[16][0] = "NETHOOD"
$Array[16][1] = NETHOOD()
$Array[17][0] = "FONTS"
$Array[17][1] = FONTS()
$Array[18][0] = "TEMPLATES"
$Array[18][1] = TEMPLATES()
$Array[19][0] = "COMMON_STARTMENU"
$Array[19][1] = COMMON_STARTMENU()
$Array[20][0] = "COMMON_PROGRAMS"
$Array[20][1] = COMMON_PROGRAMS()
$Array[21][0] = "COMMON_STARTUP"
$Array[21][1] = COMMON_STARTUP()
$Array[22][0] = "COMMON_DESKTOPDIRECTORY"
$Array[22][1] = COMMON_DESKTOPDIRECTORY()
$Array[23][0] = "APPDATA"
$Array[23][1] = APPDATA()
$Array[24][0] = "PRINTHOOD"
$Array[24][1] = PRINTHOOD()
$Array[25][0] = "LOCAL_APPDATA"
$Array[25][1] = LOCAL_APPDATA()
$Array[26][0] = "ALTSTARTUP"
$Array[26][1] = ALTSTARTUP()
$Array[27][0] = "COMMON_ALTSTARTUP"
$Array[27][1] = COMMON_ALTSTARTUP()
$Array[28][0] = "COMMON_FAVORITES"
$Array[28][1] = COMMON_FAVORITES()
$Array[29][0] = "INTERNET_CACHE"
$Array[29][1] = INTERNET_CACHE()
$Array[30][0] = "COOKIES"
$Array[30][1] = COOKIES()
$Array[31][0] = "HISTORY"
$Array[31][1] = HISTORY()
$Array[32][0] = "COMMON_APPDATA"
$Array[32][1] = COMMON_APPDATA()
$Array[33][0] = "WINDOWS"
$Array[33][1] = WINDOWS()
$Array[34][0] = "SYSTEM"
$Array[34][1] = SYSTEM()
$Array[35][0] = "PROGRAM_FILES"
$Array[35][1] = PROGRAM_FILES()
$Array[36][0] = "MYPICTURES"
$Array[36][1] = MYPICTURES()
$Array[37][0] = "PROFILE"
$Array[37][1] = PROFILE()
$Array[38][0] = "SYSTEMX86"
$Array[38][1] = SYSTEMX86()
$Array[39][0] = "PROGRAM_FILESX86"
$Array[39][1] = PROGRAM_FILESX86()
$Array[40][0] = "PROGRAM_FILES_COMMON"
$Array[40][1] = PROGRAM_FILES_COMMON()
$Array[41][0] = "PROGRAM_FILES_COMMONX86"
$Array[41][1] = PROGRAM_FILES_COMMONX86()
$Array[42][0] = "COMMON_TEMPLATES"
$Array[42][1] = COMMON_TEMPLATES()
$Array[43][0] = "COMMON_DOCUMENTS"
$Array[43][1] = COMMON_DOCUMENTS()
$Array[44][0] = "COMMON_ADMINTOOLS"
$Array[44][1] = COMMON_ADMINTOOLS()
$Array[45][0] = "ADMINTOOLS"
$Array[45][1] = ADMINTOOLS()
$Array[46][0] = "CONNECTIONS"
$Array[46][1] = CONNECTIONS()
$Array[47][0] = "COMMON_MUSIC"
$Array[47][1] = COMMON_MUSIC()
$Array[48][0] = "COMMON_PICTURES"
$Array[48][1] = COMMON_PICTURES()
$Array[49][0] = "COMMON_VIDEO"
$Array[49][1] = COMMON_VIDEO()
$Array[50][0] = "RESOURCES"
$Array[50][1] = RESOURCES()
$Array[51][0] = "RESOURCES_LOCALIZED"
$Array[51][1] = RESOURCES_LOCALIZED()
$Array[52][0] = "COMMON_OEM_LINKS"
$Array[52][1] = COMMON_OEM_LINKS()
$Array[53][0] = "CDBURN_AREA"
$Array[53][1] = CDBURN_AREA()
$Array[54][0] = "COMPUTERSNEARME"
$Array[54][1] = COMPUTERSNEARME()


_ArrayDisplay($Array,"")
;Constants

;CSIDL_ADMINTOOLS (FOLDERID_AdminTools)
;;Version 5.0. The file system directory that is used to store administrative tools for an individual user. The Microsoft Management Console (MMC) will save customized consoles to this directory, and it will roam with the user.
;CSIDL_ALTSTARTUP (FOLDERID_Startup)
;;The file system directory that corresponds to the user's nonlocalized Startup program group. This value is recognized in Windows Vista for backward compatibility, but the folder itself no longer exists.
;CSIDL_APPDATA (FOLDERID_RoamingAppData)
;;Version 4.71. The file system directory that serves as a common repository for application-specific data. A typical path is C:\Documents and Settings\username\Application Data. This CSIDL is supported by the redistributable Shfolder.dll for systems that do not have the Microsoft Internet Explorer 4.0 integrated Shell installed.
;CSIDL_BITBUCKET (FOLDERID_RecycleBinFolder)
;;The virtual folder that contains the objects in the user's Recycle Bin.
;CSIDL_CDBURN_AREA (FOLDERID_CDBurning)
;;Version 6.0. The file system directory that acts as a staging area for files waiting to be written to a CD. A typical path is C:\Documents and Settings\username\Local Settings\Application Data\Microsoft\CD Burning.
;CSIDL_COMMON_ADMINTOOLS (FOLDERID_CommonAdminTools)
;;Version 5.0. The file system directory that contains administrative tools for all users of the computer.
;CSIDL_COMMON_ALTSTARTUP (FOLDERID_Commonstartup)
;;The file system directory that corresponds to the nonlocalized Startup program group for all users. Valid only for Microsoft Windows NT systems. This value is recognized in Windows Vista for backward compatibility, but the folder itself no longer exists.
;CSIDL_COMMON_APPDATA (FOLDERID_ProgramData)
;;Version 5.0. The file system directory that contains application data for all users. A typical path is C:\Documents and Settings\All Users\Application Data. This folder is used for application data that is not user specific. For example, an application can store a spell-check dictionary, a database of clip art, or a log file in the CSIDL_COMMON_APPDATA folder. This information will not roam and is available to anyone using the computer.
;CSIDL_COMMON_DESKTOPDIRECTORY (FOLDERID_PublicDesktop)
;;The file system directory that contains files and folders that appear on the desktop for all users. A typical path is C:\Documents and Settings\All Users\Desktop. Valid only for Windows NT systems.
;CSIDL_COMMON_DOCUMENTS (FOLDERID_PublicDocuments)
;;The file system directory that contains documents that are common to all users. A typical paths is C:\Documents and Settings\All Users\Documents. Valid for Windows NT systems and Microsoft Windows 95 and Windows 98 systems with Shfolder.dll installed.
;CSIDL_COMMON_FAVORITES (FOLDERID_Favorites)
;;The file system directory that serves as a common repository for favorite items common to all users. Valid only for Windows NT systems.
;CSIDL_COMMON_MUSIC (FOLDERID_PublicMusic)
;;Version 6.0. The file system directory that serves as a repository for music files common to all users. A typical path is C:\Documents and Settings\All Users\Documents\My Music.
;CSIDL_COMMON_OEM_LINKS (FOLDERID_CommonOEMLinks)
;;This value is recognized in Windows Vista for backward compatibility, but the folder itself is no longer used.
;CSIDL_COMMON_PICTURES (FOLDERID_PublicPictures)
;;Version 6.0. The file system directory that serves as a repository for image files common to all users. A typical path is C:\Documents and Settings\All Users\Documents\My Pictures.
;CSIDL_COMMON_PROGRAMS (FOLDERID_CommonPrograms)
;;The file system directory that contains the directories for the common program groups that appear on the Start menu for all users. A typical path is C:\Documents and Settings\All Users\Start Menu\Programs. Valid only for Windows NT systems.
;CSIDL_COMMON_STARTMENU (FOLDERID_CommonstartMenu)
;;The file system directory that contains the programs and folders that appear on the Start menu for all users. A typical path is C:\Documents and Settings\All Users\Start Menu. Valid only for Windows NT systems.
;CSIDL_COMMON_STARTUP (FOLDERID_Commonstartup)
;;The file system directory that contains the programs that appear in the Startup folder for all users. A typical path is C:\Documents and Settings\All Users\Start Menu\Programs\Startup. Valid only for Windows NT systems.
;CSIDL_COMMON_TEMPLATES (FOLDERID_CommonTemplates)
;;The file system directory that contains the templates that are available to all users. A typical path is C:\Documents and Settings\All Users\Templates. Valid only for Windows NT systems.
;CSIDL_COMMON_VIDEO (FOLDERID_PublicVideos)
;;Version 6.0. The file system directory that serves as a repository for video files common to all users. A typical path is C:\Documents and Settings\All Users\Documents\My Videos.
;CSIDL_COMPUTERSNEARME (FOLDERID_NetworkFolder)
;;The folder that represents other computers in your workgroup.
;CSIDL_CONNECTIONS (FOLDERID_ConnectionsFolder)
;;The virtual folder that represents Network Connections, that contains network and dial-up connections.
;CSIDL_CONTROLS (FOLDERID_ControlPanelFolder)
;;The virtual folder that contains icons for the Control Panel applications.
;CSIDL_COOKIES (FOLDERID_Cookies)
;;The file system directory that serves as a common repository for Internet cookies. A typical path is C:\Documents and Settings\username\Cookies.
;CSIDL_DESKTOP (FOLDERID_Desktop)
;;The virtual folder that represents the Windows desktop, the root of the namespace.
;CSIDL_DESKTOPDIRECTORY (FOLDERID_Desktop)
;;The file system directory used to physically store file objects on the desktop (not to be confused with the desktop folder itself). A typical path is C:\Documents and Settings\username\Desktop.
;CSIDL_DRIVES (FOLDERID_ComputerFolder)
;;The virtual folder that represents My Computer, containing everything on the local computer: storage devices, printers, and Control Panel. The folder can also contain mapped network drives.
;CSIDL_FAVORITES (FOLDERID_Favorites)
;;The file system directory that serves as a common repository for the user's favorite items. A typical path is C:\Documents and Settings\username\Favorites.
;CSIDL_FONTS (FOLDERID_Fonts)
;;A virtual folder that contains fonts. A typical path is C:\Windows\Fonts.
;CSIDL_HISTORY (FOLDERID_History)
;;The file system directory that serves as a common repository for Internet history items.
;CSIDL_INTERNET (FOLDERID_InternetFolder)
;;A virtual folder for Internet Explorer. 
;CSIDL_INTERNET_CACHE (FOLDERID_InternetCache)
;;Version 4.72. The file system directory that serves as a common repository for temporary Internet files. A typical path is C:\Documents and Settings\username\Local Settings\Temporary Internet Files.
;CSIDL_LOCAL_APPDATA (FOLDERID_LocalAppData)
;;Version 5.0. The file system directory that serves as a data repository for local (nonroaming) applications. A typical path is C:\Documents and Settings\username\Local Settings\Application Data.
;CSIDL_MYDOCUMENTS (FOLDERID_Documents)
;;Version 6.0. The virtual folder that represents the My Documents desktop item. This value is equivalent to CSIDL_PERSONAL.
;CSIDL_MYMUSIC (FOLDERID_Music)
;;The file system directory that serves as a common repository for music files. A typical path is C:\Documents and Settings\User\My Documents\My Music.
;CSIDL_MYPICTURES (FOLDERID_Pictures)
;;Version 5.0. The file system directory that serves as a common repository for image files. A typical path is C:\Documents and Settings\username\My Documents\My Pictures.
;CSIDL_MYVIDEO (FOLDERID_Videos)
;;Version 6.0. The file system directory that serves as a common repository for video files. A typical path is C:\Documents and Settings\username\My Documents\My Videos.
;CSIDL_NETHOOD (FOLDERID_NetHood)
;;A file system directory that contains the link objects that may exist in the My Network Places virtual folder. It is not the same as CSIDL_NETWORK, which represents the network namespace root. A typical path is C:\Documents and Settings\username\NetHood.
;CSIDL_NETWORK (FOLDERID_NetworkFolder)
;;A virtual folder that represents Network Neighborhood, the root of the network namespace hierarchy.
;CSIDL_PERSONAL (FOLDERID_Documents)
;;Version 6.0. The virtual folder that represents the My Documents desktop item. This is equivalent to CSIDL_MYDOCUMENTS.

;;Previous to Version 6.0. The file system directory used to physically store a user's common repository of documents. A typical path is C:\Documents and Settings\username\My Documents. This should be distinguished from the virtual My Documents folder in the namespace. To access that virtual folder, use SHGetFolderLocation, which returns the ITEMIDLIST for the virtual location, or refer to the technique described in Managing the File System.
;CSIDL_PRINTERS (FOLDERID_PrintersFolder)
;;The virtual folder that contains installed printers.
;CSIDL_PRINTHOOD (FOLDERID_PrintHood)
;;The file system directory that contains the link objects that can exist in the Printers virtual folder. A typical path is C:\Documents and Settings\username\PrintHood.
;CSIDL_PROFILE (FOLDERID_Profile)
;;Version 5.0. The user's profile folder. A typical path is C:\Users\username. Applications should not create files or folders at this level; they should put their data under the locations referred to by CSIDL_APPDATA or CSIDL_LOCAL_APPDATA. However, if you are creating a new Known Folder the profile root refered to by CSIDL_PROFILE is appropriate.
;CSIDL_PROGRAM_FILES (FOLDERID_ProgramFiles)
;;Version 5.0. The Program Files folder. A typical path is C:\Program Files.
;CSIDL_PROGRAM_FILESX86 (FOLDERID_ProgramFilesX86)
;CSIDL_PROGRAM_FILES_COMMON (FOLDERID_ProgramFilesCommon)
;;Version 5.0. A folder for components that are shared across applications. A typical path is C:\Program Files\Common. Valid only for Windows NT, Windows 2000, and Windows XP systems. Not valid for Windows Millennium Edition (Windows Me).
;CSIDL_PROGRAM_FILES_COMMONX86 (FOLDERID_ProgramFilesCommonX86)
;CSIDL_PROGRAMS (FOLDERID_Programs)
;;The file system directory that contains the user's program groups (which are themselves file system directories). A typical path is C:\Documents and Settings\username\Start Menu\Programs. 
;CSIDL_RECENT (FOLDERID_Recent)
;;The file system directory that contains shortcuts to the user's most recently used documents. A typical path is C:\Documents and Settings\username\My Recent Documents. To create a shortcut in this folder, use SHAddToRecentDocs. In addition to creating the shortcut, this function updates the Shell's list of recent documents and adds the shortcut to the My Recent Documents submenu of the Start menu.
;CSIDL_RESOURCES (FOLDERID_ResourceDir)
;;Windows Vista. The file system directory that contains resource data. A typical path is C:\Windows\Resources.
;CSIDL_RESOURCES_LOCALIZED (FOLDERID_LocalizedResourcesDir)
;CSIDL_SENDTO (FOLDERID_SendTo)
;;The file system directory that contains Send To menu items. A typical path is C:\Documents and Settings\username\SendTo.
;CSIDL_STARTMENU (FOLDERID_StartMenu)
;;The file system directory that contains Start menu items. A typical path is C:\Documents and Settings\username\Start Menu.
;CSIDL_STARTUP (FOLDERID_Startup)
;;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. A typical path is C:\Documents and Settings\username\Start Menu\Programs\Startup.
;CSIDL_SYSTEM (FOLDERID_System)
;;Version 5.0. The Windows System folder. A typical path is C:\Windows\System32.
;CSIDL_SYSTEMX86 (FOLDERID_SystemX86)
;CSIDL_TEMPLATES (FOLDERID_Templates)
;;The file system directory that serves as a common repository for document templates. A typical path is C:\Documents and Settings\username\Templates.
;CSIDL_WINDOWS (FOLDERID_Windows)
;;Version 5.0. The Windows directory or SYSROOT. This corresponds to the %windir% or %SYSTEMROOT% environment variables. A typical path is C:\Windows.
;Flags 
;CSIDL_FLAG_CREATE (KF_FLAG_CREATE)
;;Version 5.0. Combine with another CSIDL to force the creation of the associated folder if it does not exist.
;CSIDL_FLAG_DONT_UNEXPAND (KF_FLAG_DONT_UNEXPAND)
;;Combine with another CSIDL constant to ensure the expansion of environment variables.
;CSIDL_FLAG_DONT_VERIFY (KF_FLAG_DONT_VERIFY)
;;Combine with another CSIDL constant, except for CSIDL_FLAG_CREATE, to return an unverified folder path with no attempt to create or initialize the folder.
;CSIDL_FLAG_NO_ALIAS (KF_FLAG_NO_ALIAS)
;;Combine with another CSIDL constant to ensure the retrieval of the true system path for the folder, free of any aliased placeholders such as %USERPROFILE%, returned by SHGetFolderLocation. This flag has no effect on paths returned by SHGetFolderPath.
;CSIDL_FLAG_PER_USER_INIT 
;CSIDL_FLAG_MASK 
;;A mask for any valid CSIDL flag value.


Func DESKTOP()
Return SHGetSpecialFolderPath($CSIDL_DESKTOP)
EndFunc
Func INTERNET()
Return SHGetSpecialFolderPath($CSIDL_INTERNET)
EndFunc
Func PROGRAMS()
Return SHGetSpecialFolderPath($CSIDL_PROGRAMS)
EndFunc
Func CONTROLS()
Return SHGetSpecialFolderPath($CSIDL_CONTROLS)
EndFunc
Func PRINTERS()
Return SHGetSpecialFolderPath($CSIDL_PRINTERS)
EndFunc
Func PERSONAL()
Return SHGetSpecialFolderPath($CSIDL_PERSONAL)
EndFunc
Func FAVORITES()
Return SHGetSpecialFolderPath($CSIDL_FAVORITES)
EndFunc
Func STARTUP()
Return SHGetSpecialFolderPath($CSIDL_STARTUP)
EndFunc
Func RECENT()
Return SHGetSpecialFolderPath($CSIDL_RECENT)
EndFunc
Func SENDTO()
Return SHGetSpecialFolderPath($CSIDL_SENDTO)
EndFunc
Func BITBUCKET()
Return SHGetSpecialFolderPath($CSIDL_BITBUCKET)
EndFunc
Func STARTMENU()
Return SHGetSpecialFolderPath($CSIDL_STARTMENU)
EndFunc
Func DESKTOPDIRECTORY()
Return SHGetSpecialFolderPath($CSIDL_DESKTOPDIRECTORY)
EndFunc
Func DRIVES()
Return SHGetSpecialFolderPath($CSIDL_DRIVES)
EndFunc
Func NETWORK()
Return SHGetSpecialFolderPath($CSIDL_NETWORK)
EndFunc
Func NETHOOD()
Return SHGetSpecialFolderPath($CSIDL_NETHOOD)
EndFunc
Func FONTS()
Return SHGetSpecialFolderPath($CSIDL_FONTS)
EndFunc
Func TEMPLATES()
Return SHGetSpecialFolderPath($CSIDL_TEMPLATES)
EndFunc
Func COMMON_STARTMENU()
Return SHGetSpecialFolderPath($CSIDL_COMMON_STARTMENU)
EndFunc
Func COMMON_PROGRAMS()
Return SHGetSpecialFolderPath($CSIDL_COMMON_PROGRAMS)
EndFunc
Func COMMON_STARTUP()
Return SHGetSpecialFolderPath($CSIDL_COMMON_STARTUP)
EndFunc
Func COMMON_DESKTOPDIRECTORY()
Return SHGetSpecialFolderPath($CSIDL_COMMON_DESKTOPDIRECTORY)
EndFunc
Func APPDATA()
Return SHGetSpecialFolderPath($CSIDL_APPDATA)
EndFunc
Func PRINTHOOD()
Return SHGetSpecialFolderPath($CSIDL_PRINTHOOD)
EndFunc
Func LOCAL_APPDATA()
Return SHGetSpecialFolderPath($CSIDL_LOCAL_APPDATA)
EndFunc
Func ALTSTARTUP()
Return SHGetSpecialFolderPath($CSIDL_ALTSTARTUP)
EndFunc
Func COMMON_ALTSTARTUP()
Return SHGetSpecialFolderPath($CSIDL_COMMON_ALTSTARTUP)
EndFunc
Func COMMON_FAVORITES()
Return SHGetSpecialFolderPath($CSIDL_COMMON_FAVORITES)
EndFunc
Func INTERNET_CACHE()
Return SHGetSpecialFolderPath($CSIDL_INTERNET_CACHE)
EndFunc
Func COOKIES()
Return SHGetSpecialFolderPath($CSIDL_COOKIES)
EndFunc
Func HISTORY()
Return SHGetSpecialFolderPath($CSIDL_HISTORY)
EndFunc
Func COMMON_APPDATA()
Return SHGetSpecialFolderPath($CSIDL_COMMON_APPDATA)
EndFunc
Func WINDOWS()
Return SHGetSpecialFolderPath($CSIDL_WINDOWS)
EndFunc
Func SYSTEM()
Return SHGetSpecialFolderPath($CSIDL_SYSTEM)
EndFunc
Func PROGRAM_FILES()
Return SHGetSpecialFolderPath($CSIDL_PROGRAM_FILES)
EndFunc
Func MYPICTURES()
Return SHGetSpecialFolderPath($CSIDL_MYPICTURES)
EndFunc
Func PROFILE()
Return SHGetSpecialFolderPath($CSIDL_PROFILE)
EndFunc
Func SYSTEMX86()
Return SHGetSpecialFolderPath($CSIDL_SYSTEMX86)
EndFunc
Func PROGRAM_FILESX86()
Return SHGetSpecialFolderPath($CSIDL_PROGRAM_FILESX86)
EndFunc
Func PROGRAM_FILES_COMMON()
Return SHGetSpecialFolderPath($CSIDL_PROGRAM_FILES_COMMON)
EndFunc
Func PROGRAM_FILES_COMMONX86()
Return SHGetSpecialFolderPath($CSIDL_PROGRAM_FILES_COMMONX86)
EndFunc
Func COMMON_TEMPLATES()
Return SHGetSpecialFolderPath($CSIDL_COMMON_TEMPLATES)
EndFunc
Func COMMON_DOCUMENTS()
Return SHGetSpecialFolderPath($CSIDL_COMMON_DOCUMENTS)
EndFunc
Func COMMON_ADMINTOOLS()
Return SHGetSpecialFolderPath($CSIDL_COMMON_ADMINTOOLS)
EndFunc
Func ADMINTOOLS()
Return SHGetSpecialFolderPath($CSIDL_ADMINTOOLS)
EndFunc
Func CONNECTIONS()
Return SHGetSpecialFolderPath($CSIDL_CONNECTIONS)
EndFunc
Func COMMON_MUSIC()
Return SHGetSpecialFolderPath($CSIDL_COMMON_MUSIC)
EndFunc
Func COMMON_PICTURES()
Return SHGetSpecialFolderPath($CSIDL_COMMON_PICTURES)
EndFunc
Func COMMON_VIDEO()
Return SHGetSpecialFolderPath($CSIDL_COMMON_VIDEO)
EndFunc
Func RESOURCES()
Return SHGetSpecialFolderPath($CSIDL_RESOURCES)
EndFunc
Func RESOURCES_LOCALIZED()
Return SHGetSpecialFolderPath($CSIDL_RESOURCES_LOCALIZED)
EndFunc
Func COMMON_OEM_LINKS()
Return SHGetSpecialFolderPath($CSIDL_COMMON_OEM_LINKS)
EndFunc
Func CDBURN_AREA()
Return SHGetSpecialFolderPath($CSIDL_CDBURN_AREA)
EndFunc
Func COMPUTERSNEARME()
Return SHGetSpecialFolderPath($CSIDL_COMPUTERSNEARME)
EndFunc


Func SHGetSpecialFolderPath($csidl)
;hwndOwner
;Reserved.

;lpszPath
;[out] A pointer to a null-terminated string that receives the drive and path of the 
;specified folder. This buffer must be at least MAX_PATH characters in size.

;csidl
;[in] A CSIDL that identifies the folder of interest. If a virtual folder is specified
;, this function will fail.

;fCreate
;[in] Indicates whether the folder should be created if it does not already exist. If 
;this value is nonzero, the folder is created. If this value is zero, the folder is
;not created.
Local $hwndOwner = 0 , $lpszPath = "" , $fCreate = False , $MAX_PATH = 260
$lpszPath = DllStructCreate("char[" & $MAX_PATH & "]")
$BOOL = DllCall("shell32.dl","int","SHGetSpecialFolderPath","int",$hwndOwner,"ptr", _ 
DllStructGetPtr($lpszPath),"int",$csidl,"int",$fCreate)
if Not @error Then
Return SetError($BOOL[0],0,DllStructGetData($lpszPath,1))
Else
Return SetError(@error,0,0)
EndIf
EndFunc

صرح السماء كان هنا

 

Link to comment
Share on other sites

And what?

This result $BOOL

Is not the same the @error macro result

There is a difference between them

$BOOL A result of the shell32.dll library function

@error A result of the function DllCall In Autoit

There is a possibility that the result of @error macro Equal

to zero and the result $BOOL is equal to zero Or one

Try this code and consider the values of the $BOOL

In the Array

#Include <Array.au3>
Const $CSIDL_DESKTOP = 0
Const $CSIDL_INTERNET = 1
Const $CSIDL_PROGRAMS = 2
Const $CSIDL_CONTROLS = 3
Const $CSIDL_PRINTERS = 4
Const $CSIDL_PERSONAL = 5
Const $CSIDL_FAVORITES = 6
Const $CSIDL_STARTUP = 7
Const $CSIDL_RECENT = 8
Const $CSIDL_SENDTO = 9
Const $CSIDL_BITBUCKET = 10
Const $CSIDL_STARTMENU = 11
Const $CSIDL_DESKTOPDIRECTORY = 16
Const $CSIDL_DRIVES = 17
Const $CSIDL_NETWORK = 18
Const $CSIDL_NETHOOD = 19
Const $CSIDL_FONTS = 20
Const $CSIDL_TEMPLATES = 21
Const $CSIDL_COMMON_STARTMENU = 22
Const $CSIDL_COMMON_PROGRAMS = 23
Const $CSIDL_COMMON_STARTUP = 24
Const $CSIDL_COMMON_DESKTOPDIRECTORY = 25
Const $CSIDL_APPDATA = 26
Const $CSIDL_PRINTHOOD = 27
Const $CSIDL_LOCAL_APPDATA = 28
Const $CSIDL_ALTSTARTUP = 29
Const $CSIDL_COMMON_ALTSTARTUP = 30
Const $CSIDL_COMMON_FAVORITES = 31
Const $CSIDL_INTERNET_CACHE = 32
Const $CSIDL_COOKIES = 33
Const $CSIDL_HISTORY = 34
Const $CSIDL_COMMON_APPDATA = 35
Const $CSIDL_WINDOWS = 36
Const $CSIDL_SYSTEM = 37
Const $CSIDL_PROGRAM_FILES = 38
Const $CSIDL_MYPICTURES = 39
Const $CSIDL_PROFILE = 40
Const $CSIDL_SYSTEMX86 = 41
Const $CSIDL_PROGRAM_FILESX86 = 42
Const $CSIDL_PROGRAM_FILES_COMMON = 43
Const $CSIDL_PROGRAM_FILES_COMMONX86 = 44
Const $CSIDL_COMMON_TEMPLATES = 45
Const $CSIDL_COMMON_DOCUMENTS = 46
Const $CSIDL_COMMON_ADMINTOOLS = 47
Const $CSIDL_ADMINTOOLS = 48
Const $CSIDL_CONNECTIONS = 49
Const $CSIDL_COMMON_MUSIC = 53
Const $CSIDL_COMMON_PICTURES = 54
Const $CSIDL_COMMON_VIDEO = 55
Const $CSIDL_RESOURCES = 56
Const $CSIDL_RESOURCES_LOCALIZED = 57
Const $CSIDL_COMMON_OEM_LINKS = 58
Const $CSIDL_CDBURN_AREA = 59
Const $CSIDL_COMPUTERSNEARME = 61
Dim $Array[55][2]
$Array[1][0] = "DESKTOP"
$Array[1][1] = DESKTOP()
$Array[2][0] = "INTERNET"
$Array[2][1] = INTERNET()
$Array[3][0] = "PROGRAMS"
$Array[3][1] = PROGRAMS()
$Array[4][0] = "CONTROLS"
$Array[4][1] = CONTROLS()
$Array[5][0] = "PRINTERS"
$Array[5][1] = PRINTERS()
$Array[6][0] = "PERSONAL"
$Array[6][1] = PERSONAL()
$Array[7][0] = "FAVORITES"
$Array[7][1] = FAVORITES()
$Array[8][0] = "STARTUP"
$Array[8][1] = STARTUP()
$Array[9][0] = "RECENT"
$Array[9][1] = RECENT()
$Array[10][0] = "SENDTO"
$Array[10][1] = SENDTO()
$Array[11][0] = "BITBUCKET"
$Array[11][1] = BITBUCKET()
$Array[12][0] = "STARTMENU"
$Array[12][1] = STARTMENU()
$Array[13][0] = "DESKTOPDIRECTORY"
$Array[13][1] = DESKTOPDIRECTORY()
$Array[14][0] = "DRIVES"
$Array[14][1] = DRIVES()
$Array[15][0] = "NETWORK"
$Array[15][1] = NETWORK()
$Array[16][0] = "NETHOOD"
$Array[16][1] = NETHOOD()
$Array[17][0] = "FONTS"
$Array[17][1] = FONTS()
$Array[18][0] = "TEMPLATES"
$Array[18][1] = TEMPLATES()
$Array[19][0] = "COMMON_STARTMENU"
$Array[19][1] = COMMON_STARTMENU()
$Array[20][0] = "COMMON_PROGRAMS"
$Array[20][1] = COMMON_PROGRAMS()
$Array[21][0] = "COMMON_STARTUP"
$Array[21][1] = COMMON_STARTUP()
$Array[22][0] = "COMMON_DESKTOPDIRECTORY"
$Array[22][1] = COMMON_DESKTOPDIRECTORY()
$Array[23][0] = "APPDATA"
$Array[23][1] = APPDATA()
$Array[24][0] = "PRINTHOOD"
$Array[24][1] = PRINTHOOD()
$Array[25][0] = "LOCAL_APPDATA"
$Array[25][1] = LOCAL_APPDATA()
$Array[26][0] = "ALTSTARTUP"
$Array[26][1] = ALTSTARTUP()
$Array[27][0] = "COMMON_ALTSTARTUP"
$Array[27][1] = COMMON_ALTSTARTUP()
$Array[28][0] = "COMMON_FAVORITES"
$Array[28][1] = COMMON_FAVORITES()
$Array[29][0] = "INTERNET_CACHE"
$Array[29][1] = INTERNET_CACHE()
$Array[30][0] = "COOKIES"
$Array[30][1] = COOKIES()
$Array[31][0] = "HISTORY"
$Array[31][1] = HISTORY()
$Array[32][0] = "COMMON_APPDATA"
$Array[32][1] = COMMON_APPDATA()
$Array[33][0] = "WINDOWS"
$Array[33][1] = WINDOWS()
$Array[34][0] = "SYSTEM"
$Array[34][1] = SYSTEM()
$Array[35][0] = "PROGRAM_FILES"
$Array[35][1] = PROGRAM_FILES()
$Array[36][0] = "MYPICTURES"
$Array[36][1] = MYPICTURES()
$Array[37][0] = "PROFILE"
$Array[37][1] = PROFILE()
$Array[38][0] = "SYSTEMX86"
$Array[38][1] = SYSTEMX86()
$Array[39][0] = "PROGRAM_FILESX86"
$Array[39][1] = PROGRAM_FILESX86()
$Array[40][0] = "PROGRAM_FILES_COMMON"
$Array[40][1] = PROGRAM_FILES_COMMON()
$Array[41][0] = "PROGRAM_FILES_COMMONX86"
$Array[41][1] = PROGRAM_FILES_COMMONX86()
$Array[42][0] = "COMMON_TEMPLATES"
$Array[42][1] = COMMON_TEMPLATES()
$Array[43][0] = "COMMON_DOCUMENTS"
$Array[43][1] = COMMON_DOCUMENTS()
$Array[44][0] = "COMMON_ADMINTOOLS"
$Array[44][1] = COMMON_ADMINTOOLS()
$Array[45][0] = "ADMINTOOLS"
$Array[45][1] = ADMINTOOLS()
$Array[46][0] = "CONNECTIONS"
$Array[46][1] = CONNECTIONS()
$Array[47][0] = "COMMON_MUSIC"
$Array[47][1] = COMMON_MUSIC()
$Array[48][0] = "COMMON_PICTURES"
$Array[48][1] = COMMON_PICTURES()
$Array[49][0] = "COMMON_VIDEO"
$Array[49][1] = COMMON_VIDEO()
$Array[50][0] = "RESOURCES"
$Array[50][1] = RESOURCES()
$Array[51][0] = "RESOURCES_LOCALIZED"
$Array[51][1] = RESOURCES_LOCALIZED()
$Array[52][0] = "COMMON_OEM_LINKS"
$Array[52][1] = COMMON_OEM_LINKS()
$Array[53][0] = "CDBURN_AREA"
$Array[53][1] = CDBURN_AREA()
$Array[54][0] = "COMPUTERSNEARME"
$Array[54][1] = COMPUTERSNEARME()


_ArrayDisplay($Array,"")
;Constants

;CSIDL_ADMINTOOLS (FOLDERID_AdminTools)
;;Version 5.0. The file system directory that is used to store administrative tools for an individual user. The Microsoft Management Console (MMC) will save customized consoles to this directory, and it will roam with the user.
;CSIDL_ALTSTARTUP (FOLDERID_Startup)
;;The file system directory that corresponds to the user's nonlocalized Startup program group. This value is recognized in Windows Vista for backward compatibility, but the folder itself no longer exists.
;CSIDL_APPDATA (FOLDERID_RoamingAppData)
;;Version 4.71. The file system directory that serves as a common repository for application-specific data. A typical path is C:\Documents and Settings\username\Application Data. This CSIDL is supported by the redistributable Shfolder.dll for systems that do not have the Microsoft Internet Explorer 4.0 integrated Shell installed.
;CSIDL_BITBUCKET (FOLDERID_RecycleBinFolder)
;;The virtual folder that contains the objects in the user's Recycle Bin.
;CSIDL_CDBURN_AREA (FOLDERID_CDBurning)
;;Version 6.0. The file system directory that acts as a staging area for files waiting to be written to a CD. A typical path is C:\Documents and Settings\username\Local Settings\Application Data\Microsoft\CD Burning.
;CSIDL_COMMON_ADMINTOOLS (FOLDERID_CommonAdminTools)
;;Version 5.0. The file system directory that contains administrative tools for all users of the computer.
;CSIDL_COMMON_ALTSTARTUP (FOLDERID_Commonstartup)
;;The file system directory that corresponds to the nonlocalized Startup program group for all users. Valid only for Microsoft Windows NT systems. This value is recognized in Windows Vista for backward compatibility, but the folder itself no longer exists.
;CSIDL_COMMON_APPDATA (FOLDERID_ProgramData)
;;Version 5.0. The file system directory that contains application data for all users. A typical path is C:\Documents and Settings\All Users\Application Data. This folder is used for application data that is not user specific. For example, an application can store a spell-check dictionary, a database of clip art, or a log file in the CSIDL_COMMON_APPDATA folder. This information will not roam and is available to anyone using the computer.
;CSIDL_COMMON_DESKTOPDIRECTORY (FOLDERID_PublicDesktop)
;;The file system directory that contains files and folders that appear on the desktop for all users. A typical path is C:\Documents and Settings\All Users\Desktop. Valid only for Windows NT systems.
;CSIDL_COMMON_DOCUMENTS (FOLDERID_PublicDocuments)
;;The file system directory that contains documents that are common to all users. A typical paths is C:\Documents and Settings\All Users\Documents. Valid for Windows NT systems and Microsoft Windows 95 and Windows 98 systems with Shfolder.dll installed.
;CSIDL_COMMON_FAVORITES (FOLDERID_Favorites)
;;The file system directory that serves as a common repository for favorite items common to all users. Valid only for Windows NT systems.
;CSIDL_COMMON_MUSIC (FOLDERID_PublicMusic)
;;Version 6.0. The file system directory that serves as a repository for music files common to all users. A typical path is C:\Documents and Settings\All Users\Documents\My Music.
;CSIDL_COMMON_OEM_LINKS (FOLDERID_CommonOEMLinks)
;;This value is recognized in Windows Vista for backward compatibility, but the folder itself is no longer used.
;CSIDL_COMMON_PICTURES (FOLDERID_PublicPictures)
;;Version 6.0. The file system directory that serves as a repository for image files common to all users. A typical path is C:\Documents and Settings\All Users\Documents\My Pictures.
;CSIDL_COMMON_PROGRAMS (FOLDERID_CommonPrograms)
;;The file system directory that contains the directories for the common program groups that appear on the Start menu for all users. A typical path is C:\Documents and Settings\All Users\Start Menu\Programs. Valid only for Windows NT systems.
;CSIDL_COMMON_STARTMENU (FOLDERID_CommonstartMenu)
;;The file system directory that contains the programs and folders that appear on the Start menu for all users. A typical path is C:\Documents and Settings\All Users\Start Menu. Valid only for Windows NT systems.
;CSIDL_COMMON_STARTUP (FOLDERID_Commonstartup)
;;The file system directory that contains the programs that appear in the Startup folder for all users. A typical path is C:\Documents and Settings\All Users\Start Menu\Programs\Startup. Valid only for Windows NT systems.
;CSIDL_COMMON_TEMPLATES (FOLDERID_CommonTemplates)
;;The file system directory that contains the templates that are available to all users. A typical path is C:\Documents and Settings\All Users\Templates. Valid only for Windows NT systems.
;CSIDL_COMMON_VIDEO (FOLDERID_PublicVideos)
;;Version 6.0. The file system directory that serves as a repository for video files common to all users. A typical path is C:\Documents and Settings\All Users\Documents\My Videos.
;CSIDL_COMPUTERSNEARME (FOLDERID_NetworkFolder)
;;The folder that represents other computers in your workgroup.
;CSIDL_CONNECTIONS (FOLDERID_ConnectionsFolder)
;;The virtual folder that represents Network Connections, that contains network and dial-up connections.
;CSIDL_CONTROLS (FOLDERID_ControlPanelFolder)
;;The virtual folder that contains icons for the Control Panel applications.
;CSIDL_COOKIES (FOLDERID_Cookies)
;;The file system directory that serves as a common repository for Internet cookies. A typical path is C:\Documents and Settings\username\Cookies.
;CSIDL_DESKTOP (FOLDERID_Desktop)
;;The virtual folder that represents the Windows desktop, the root of the namespace.
;CSIDL_DESKTOPDIRECTORY (FOLDERID_Desktop)
;;The file system directory used to physically store file objects on the desktop (not to be confused with the desktop folder itself). A typical path is C:\Documents and Settings\username\Desktop.
;CSIDL_DRIVES (FOLDERID_ComputerFolder)
;;The virtual folder that represents My Computer, containing everything on the local computer: storage devices, printers, and Control Panel. The folder can also contain mapped network drives.
;CSIDL_FAVORITES (FOLDERID_Favorites)
;;The file system directory that serves as a common repository for the user's favorite items. A typical path is C:\Documents and Settings\username\Favorites.
;CSIDL_FONTS (FOLDERID_Fonts)
;;A virtual folder that contains fonts. A typical path is C:\Windows\Fonts.
;CSIDL_HISTORY (FOLDERID_History)
;;The file system directory that serves as a common repository for Internet history items.
;CSIDL_INTERNET (FOLDERID_InternetFolder)
;;A virtual folder for Internet Explorer. 
;CSIDL_INTERNET_CACHE (FOLDERID_InternetCache)
;;Version 4.72. The file system directory that serves as a common repository for temporary Internet files. A typical path is C:\Documents and Settings\username\Local Settings\Temporary Internet Files.
;CSIDL_LOCAL_APPDATA (FOLDERID_LocalAppData)
;;Version 5.0. The file system directory that serves as a data repository for local (nonroaming) applications. A typical path is C:\Documents and Settings\username\Local Settings\Application Data.
;CSIDL_MYDOCUMENTS (FOLDERID_Documents)
;;Version 6.0. The virtual folder that represents the My Documents desktop item. This value is equivalent to CSIDL_PERSONAL.
;CSIDL_MYMUSIC (FOLDERID_Music)
;;The file system directory that serves as a common repository for music files. A typical path is C:\Documents and Settings\User\My Documents\My Music.
;CSIDL_MYPICTURES (FOLDERID_Pictures)
;;Version 5.0. The file system directory that serves as a common repository for image files. A typical path is C:\Documents and Settings\username\My Documents\My Pictures.
;CSIDL_MYVIDEO (FOLDERID_Videos)
;;Version 6.0. The file system directory that serves as a common repository for video files. A typical path is C:\Documents and Settings\username\My Documents\My Videos.
;CSIDL_NETHOOD (FOLDERID_NetHood)
;;A file system directory that contains the link objects that may exist in the My Network Places virtual folder. It is not the same as CSIDL_NETWORK, which represents the network namespace root. A typical path is C:\Documents and Settings\username\NetHood.
;CSIDL_NETWORK (FOLDERID_NetworkFolder)
;;A virtual folder that represents Network Neighborhood, the root of the network namespace hierarchy.
;CSIDL_PERSONAL (FOLDERID_Documents)
;;Version 6.0. The virtual folder that represents the My Documents desktop item. This is equivalent to CSIDL_MYDOCUMENTS.

;;Previous to Version 6.0. The file system directory used to physically store a user's common repository of documents. A typical path is C:\Documents and Settings\username\My Documents. This should be distinguished from the virtual My Documents folder in the namespace. To access that virtual folder, use SHGetFolderLocation, which returns the ITEMIDLIST for the virtual location, or refer to the technique described in Managing the File System.
;CSIDL_PRINTERS (FOLDERID_PrintersFolder)
;;The virtual folder that contains installed printers.
;CSIDL_PRINTHOOD (FOLDERID_PrintHood)
;;The file system directory that contains the link objects that can exist in the Printers virtual folder. A typical path is C:\Documents and Settings\username\PrintHood.
;CSIDL_PROFILE (FOLDERID_Profile)
;;Version 5.0. The user's profile folder. A typical path is C:\Users\username. Applications should not create files or folders at this level; they should put their data under the locations referred to by CSIDL_APPDATA or CSIDL_LOCAL_APPDATA. However, if you are creating a new Known Folder the profile root refered to by CSIDL_PROFILE is appropriate.
;CSIDL_PROGRAM_FILES (FOLDERID_ProgramFiles)
;;Version 5.0. The Program Files folder. A typical path is C:\Program Files.
;CSIDL_PROGRAM_FILESX86 (FOLDERID_ProgramFilesX86)
;CSIDL_PROGRAM_FILES_COMMON (FOLDERID_ProgramFilesCommon)
;;Version 5.0. A folder for components that are shared across applications. A typical path is C:\Program Files\Common. Valid only for Windows NT, Windows 2000, and Windows XP systems. Not valid for Windows Millennium Edition (Windows Me).
;CSIDL_PROGRAM_FILES_COMMONX86 (FOLDERID_ProgramFilesCommonX86)
;CSIDL_PROGRAMS (FOLDERID_Programs)
;;The file system directory that contains the user's program groups (which are themselves file system directories). A typical path is C:\Documents and Settings\username\Start Menu\Programs. 
;CSIDL_RECENT (FOLDERID_Recent)
;;The file system directory that contains shortcuts to the user's most recently used documents. A typical path is C:\Documents and Settings\username\My Recent Documents. To create a shortcut in this folder, use SHAddToRecentDocs. In addition to creating the shortcut, this function updates the Shell's list of recent documents and adds the shortcut to the My Recent Documents submenu of the Start menu.
;CSIDL_RESOURCES (FOLDERID_ResourceDir)
;;Windows Vista. The file system directory that contains resource data. A typical path is C:\Windows\Resources.
;CSIDL_RESOURCES_LOCALIZED (FOLDERID_LocalizedResourcesDir)
;CSIDL_SENDTO (FOLDERID_SendTo)
;;The file system directory that contains Send To menu items. A typical path is C:\Documents and Settings\username\SendTo.
;CSIDL_STARTMENU (FOLDERID_StartMenu)
;;The file system directory that contains Start menu items. A typical path is C:\Documents and Settings\username\Start Menu.
;CSIDL_STARTUP (FOLDERID_Startup)
;;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. A typical path is C:\Documents and Settings\username\Start Menu\Programs\Startup.
;CSIDL_SYSTEM (FOLDERID_System)
;;Version 5.0. The Windows System folder. A typical path is C:\Windows\System32.
;CSIDL_SYSTEMX86 (FOLDERID_SystemX86)
;CSIDL_TEMPLATES (FOLDERID_Templates)
;;The file system directory that serves as a common repository for document templates. A typical path is C:\Documents and Settings\username\Templates.
;CSIDL_WINDOWS (FOLDERID_Windows)
;;Version 5.0. The Windows directory or SYSROOT. This corresponds to the %windir% or %SYSTEMROOT% environment variables. A typical path is C:\Windows.
;Flags 
;CSIDL_FLAG_CREATE (KF_FLAG_CREATE)
;;Version 5.0. Combine with another CSIDL to force the creation of the associated folder if it does not exist.
;CSIDL_FLAG_DONT_UNEXPAND (KF_FLAG_DONT_UNEXPAND)
;;Combine with another CSIDL constant to ensure the expansion of environment variables.
;CSIDL_FLAG_DONT_VERIFY (KF_FLAG_DONT_VERIFY)
;;Combine with another CSIDL constant, except for CSIDL_FLAG_CREATE, to return an unverified folder path with no attempt to create or initialize the folder.
;CSIDL_FLAG_NO_ALIAS (KF_FLAG_NO_ALIAS)
;;Combine with another CSIDL constant to ensure the retrieval of the true system path for the folder, free of any aliased placeholders such as %USERPROFILE%, returned by SHGetFolderLocation. This flag has no effect on paths returned by SHGetFolderPath.
;CSIDL_FLAG_PER_USER_INIT 
;CSIDL_FLAG_MASK 
;;A mask for any valid CSIDL flag value.


Func DESKTOP()
Return SHGetSpecialFolderPath($CSIDL_DESKTOP)
EndFunc
Func INTERNET()
Return SHGetSpecialFolderPath($CSIDL_INTERNET)
EndFunc
Func PROGRAMS()
Return SHGetSpecialFolderPath($CSIDL_PROGRAMS)
EndFunc
Func CONTROLS()
Return SHGetSpecialFolderPath($CSIDL_CONTROLS)
EndFunc
Func PRINTERS()
Return SHGetSpecialFolderPath($CSIDL_PRINTERS)
EndFunc
Func PERSONAL()
Return SHGetSpecialFolderPath($CSIDL_PERSONAL)
EndFunc
Func FAVORITES()
Return SHGetSpecialFolderPath($CSIDL_FAVORITES)
EndFunc
Func STARTUP()
Return SHGetSpecialFolderPath($CSIDL_STARTUP)
EndFunc
Func RECENT()
Return SHGetSpecialFolderPath($CSIDL_RECENT)
EndFunc
Func SENDTO()
Return SHGetSpecialFolderPath($CSIDL_SENDTO)
EndFunc
Func BITBUCKET()
Return SHGetSpecialFolderPath($CSIDL_BITBUCKET)
EndFunc
Func STARTMENU()
Return SHGetSpecialFolderPath($CSIDL_STARTMENU)
EndFunc
Func DESKTOPDIRECTORY()
Return SHGetSpecialFolderPath($CSIDL_DESKTOPDIRECTORY)
EndFunc
Func DRIVES()
Return SHGetSpecialFolderPath($CSIDL_DRIVES)
EndFunc
Func NETWORK()
Return SHGetSpecialFolderPath($CSIDL_NETWORK)
EndFunc
Func NETHOOD()
Return SHGetSpecialFolderPath($CSIDL_NETHOOD)
EndFunc
Func FONTS()
Return SHGetSpecialFolderPath($CSIDL_FONTS)
EndFunc
Func TEMPLATES()
Return SHGetSpecialFolderPath($CSIDL_TEMPLATES)
EndFunc
Func COMMON_STARTMENU()
Return SHGetSpecialFolderPath($CSIDL_COMMON_STARTMENU)
EndFunc
Func COMMON_PROGRAMS()
Return SHGetSpecialFolderPath($CSIDL_COMMON_PROGRAMS)
EndFunc
Func COMMON_STARTUP()
Return SHGetSpecialFolderPath($CSIDL_COMMON_STARTUP)
EndFunc
Func COMMON_DESKTOPDIRECTORY()
Return SHGetSpecialFolderPath($CSIDL_COMMON_DESKTOPDIRECTORY)
EndFunc
Func APPDATA()
Return SHGetSpecialFolderPath($CSIDL_APPDATA)
EndFunc
Func PRINTHOOD()
Return SHGetSpecialFolderPath($CSIDL_PRINTHOOD)
EndFunc
Func LOCAL_APPDATA()
Return SHGetSpecialFolderPath($CSIDL_LOCAL_APPDATA)
EndFunc
Func ALTSTARTUP()
Return SHGetSpecialFolderPath($CSIDL_ALTSTARTUP)
EndFunc
Func COMMON_ALTSTARTUP()
Return SHGetSpecialFolderPath($CSIDL_COMMON_ALTSTARTUP)
EndFunc
Func COMMON_FAVORITES()
Return SHGetSpecialFolderPath($CSIDL_COMMON_FAVORITES)
EndFunc
Func INTERNET_CACHE()
Return SHGetSpecialFolderPath($CSIDL_INTERNET_CACHE)
EndFunc
Func COOKIES()
Return SHGetSpecialFolderPath($CSIDL_COOKIES)
EndFunc
Func HISTORY()
Return SHGetSpecialFolderPath($CSIDL_HISTORY)
EndFunc
Func COMMON_APPDATA()
Return SHGetSpecialFolderPath($CSIDL_COMMON_APPDATA)
EndFunc
Func WINDOWS()
Return SHGetSpecialFolderPath($CSIDL_WINDOWS)
EndFunc
Func SYSTEM()
Return SHGetSpecialFolderPath($CSIDL_SYSTEM)
EndFunc
Func PROGRAM_FILES()
Return SHGetSpecialFolderPath($CSIDL_PROGRAM_FILES)
EndFunc
Func MYPICTURES()
Return SHGetSpecialFolderPath($CSIDL_MYPICTURES)
EndFunc
Func PROFILE()
Return SHGetSpecialFolderPath($CSIDL_PROFILE)
EndFunc
Func SYSTEMX86()
Return SHGetSpecialFolderPath($CSIDL_SYSTEMX86)
EndFunc
Func PROGRAM_FILESX86()
Return SHGetSpecialFolderPath($CSIDL_PROGRAM_FILESX86)
EndFunc
Func PROGRAM_FILES_COMMON()
Return SHGetSpecialFolderPath($CSIDL_PROGRAM_FILES_COMMON)
EndFunc
Func PROGRAM_FILES_COMMONX86()
Return SHGetSpecialFolderPath($CSIDL_PROGRAM_FILES_COMMONX86)
EndFunc
Func COMMON_TEMPLATES()
Return SHGetSpecialFolderPath($CSIDL_COMMON_TEMPLATES)
EndFunc
Func COMMON_DOCUMENTS()
Return SHGetSpecialFolderPath($CSIDL_COMMON_DOCUMENTS)
EndFunc
Func COMMON_ADMINTOOLS()
Return SHGetSpecialFolderPath($CSIDL_COMMON_ADMINTOOLS)
EndFunc
Func ADMINTOOLS()
Return SHGetSpecialFolderPath($CSIDL_ADMINTOOLS)
EndFunc
Func CONNECTIONS()
Return SHGetSpecialFolderPath($CSIDL_CONNECTIONS)
EndFunc
Func COMMON_MUSIC()
Return SHGetSpecialFolderPath($CSIDL_COMMON_MUSIC)
EndFunc
Func COMMON_PICTURES()
Return SHGetSpecialFolderPath($CSIDL_COMMON_PICTURES)
EndFunc
Func COMMON_VIDEO()
Return SHGetSpecialFolderPath($CSIDL_COMMON_VIDEO)
EndFunc
Func RESOURCES()
Return SHGetSpecialFolderPath($CSIDL_RESOURCES)
EndFunc
Func RESOURCES_LOCALIZED()
Return SHGetSpecialFolderPath($CSIDL_RESOURCES_LOCALIZED)
EndFunc
Func COMMON_OEM_LINKS()
Return SHGetSpecialFolderPath($CSIDL_COMMON_OEM_LINKS)
EndFunc
Func CDBURN_AREA()
Return SHGetSpecialFolderPath($CSIDL_CDBURN_AREA)
EndFunc
Func COMPUTERSNEARME()
Return SHGetSpecialFolderPath($CSIDL_COMPUTERSNEARME)
EndFunc


Func SHGetSpecialFolderPath($csidl)
;hwndOwner
;Reserved.

;lpszPath
;[out] A pointer to a null-terminated string that receives the drive and path of the 
;specified folder. This buffer must be at least MAX_PATH characters in size.

;csidl
;[in] A CSIDL that identifies the folder of interest. If a virtual folder is specified
;, this function will fail.

;fCreate
;[in] Indicates whether the folder should be created if it does not already exist. If 
;this value is nonzero, the folder is created. If this value is zero, the folder is
;not created.
Local $hwndOwner = 0 , $lpszPath = "" , $fCreate = False , $MAX_PATH = 260
$lpszPath = DllStructCreate("char[" & $MAX_PATH & "]")
$BOOL = DllCall("shell32.dll","int","SHGetSpecialFolderPath","int",$hwndOwner,"ptr", _ 
DllStructGetPtr($lpszPath),"int",$csidl,"int",$fCreate)
if Not @error Then

Return SetError($BOOL[0],0,$BOOL[0])
Else
Return SetError(@error,0,3)
EndIf
EndFunc
Edited by wolf9228

صرح السماء كان هنا

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...