Jump to content

Constants for Special Folders in Windows


ptrex
 Share

Recommended Posts

Constants for Special Folders in Windows

For anyone who can use it.

; Constants for Special Folders in Windows

Const $Internet_Explorer                        = 0x1
Const $Programs                         = 0x2
Const $Control_Panel                            = 0x3
Const $Printers_and_Faxes                       = 0x4
Const $My_Documents                     = 0x5
Const $Favorites                            = 0x6
Const $Startup                          = 0x7
Const $My_Recent_Documents                      = 0x8
Const $SendTo                           = 0x9
Const $Recycle_Bin                          = 0xa
Const $Start_Menu                           = 0xb
Const $My_Music                         = 0xd
Const $My_Videos                            = 0xe
Const $Desktop                          = 0x10
Const $My_Computer                          = 0x11
Const $My_Network_Places                        = 0x12
Const $NetHood                          = 0x13
Const $Fonts                            = 0x14
Const $Templates                            = 0x15
Const $All_Users_Start_Menu                     = 0x16
Const $All_Users_Programs                       = 0x17
Const $All_Users_Startup                        = 0x18
Const $All_Users_Desktop                        = 0x19
Const $Application_Data                     = 0x1a
Const $PrintHood                            = 0x1b
Const $Local_Settings_Application_Data          = 0x1c
Const $All_Users_Favorites                      = 0x19
Const $Local_Settings_Temporary_Internet_Files  = 0x20
Const $Cookies                          = 0x21
Const $Local_Settings_History                   = 0x22
Const $All_Users_Application_Data               = 0x23
Const $Windows                          = 0x24
Const $System32                         = 0x25
Const $Program_Files                            = 0x26
Const $My_Pictures                          = 0x27
Const $User_Profile                         = 0x28
Const $Common_Files                     = 0x2b
Const $All_Users_Templates                      = 0x2e
Const $Administrative_Tools                     = 0x2f
Const $Network_Connections                      = 0x31
Const $CD_Burning_Folder                        = 0x003b

_Special_Folders($My_Network_Places)

Func _Special_Folders ($Folder)
$objShell = ObjCreate("Shell.Application")
$objShell.open($objShell.NameSpace($Folder))
EndFunc

Enjoy !!

ptrex

Edited by ptrex
Link to comment
Share on other sites

Looks good (as usual) but I notice that you are missing the CD Burning folder.

Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

@GEOSoft

Thanks !!

I don't have it lying around :"> do you ?

regards,

ptrex

I'll look, I probably do someplace. Lately I've been finding code and information that I thought I had lost years ago.

Edit:

Does this help?

CSIDL_CDBURN_AREA (0x003b)

Version 6.0. The file system directory acting as a staging area for files waiting to be written to CD. A typical path is C:\Documents and Settings\username\Local Settings\Application Data\Microsoft\CD Burning.

Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

@GEOsoft

thanks for your input !!

Const $CD_Burning_Folder = 0x003b

I have added it in the first post.

regards

ptrex

No problem!! I looked through the rest of the file that I had that in and lo & behold I was smart enough to copy the page link at the bottom of the file. You may find more here.

http://msdn2.microsoft.com/en-us/library/ms649274.aspx

Edit: I have a script that takes all of the UDF's apart and creates a separate HTM file for each function. It also creates a master list of all The constants found in all the include files so if you don't mind I'll add your constants into that list.

Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

  • 7 months later...

Guys what about Windows Explorer?

Thanks,

Windows Explorer is not a folder therefore there is no folder constant for it.

You canhowever use ShellExecute() to call Explorer.exe and use a folder constant as a parameter.

If you mean the Windows folder then just use @WindowsDir

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

  • 8 months later...

this is very nice.

to make it more convenient, please declare them in Global scope and add a prefix to all, like $SF_Internet_Explorer.

thx jennico

Spoiler

I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.OixB7.jpgDon't forget this IP: 213.251.145.96

 

Link to comment
Share on other sites

this is very nice.

to make it more convenient, please declare them in Global scope and add a prefix to all, like $SF_Internet_Explorer.

thx jennico

Just for you. I even sorted them for you.

;
Global Const $Administrative_Tools = 0x2f
Global Const $All_Users_Application_Data = 0x23
Global Const $All_Users_Desktop = 0x19
Global Const $All_Users_Favorites = 0x19
Global Const $All_Users_Programs = 0x17
Global Const $All_Users_Start_Menu = 0x16
Global Const $All_Users_Startup = 0x18
Global Const $All_Users_Templates = 0x2e
Global Const $Application_Data = 0x1a
Global Const $CD_Burning_Folder = 0x003b
Global Const $Common_Files = 0x2b
Global Const $Control_Panel = 0x3
Global Const $Cookies = 0x21
Global Const $Desktop = 0x10
Global Const $Favorites = 0x6
Global Const $Fonts = 0x14
Global Const $Internet_Explorer = 0x1
Global Const $Local_Settings_Application_Data = 0x1c
Global Const $Local_Settings_History = 0x22
Global Const $Local_Settings_Temporary_Internet_Files = 0x20
Global Const $My_Computer = 0x11
Global Const $My_Documents = 0x5
Global Const $My_Music = 0xd
Global Const $My_Network_Places = 0x12
Global Const $My_Pictures = 0x27
Global Const $My_Recent_Documents = 0x8
Global Const $My_Videos = 0xe
Global Const $NetHood = 0x13
Global Const $Network_Connections = 0x31
Global Const $Printers_and_Faxes = 0x4
Global Const $PrintHood = 0x1b
Global Const $Program_Files = 0x26
Global Const $Programs = 0x2
Global Const $Recycle_Bin = 0xa
Global Const $SendTo = 0x9
Global Const $Start_Menu = 0xb
Global Const $Startup = 0x7
Global Const $System32 = 0x25
Global Const $Templates = 0x15
Global Const $User_Profile = 0x28
Global Const $Windows = 0x24
;

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

No problem!! I looked through the rest of the file that I had that in and lo & behold I was smart enough to copy the page link at the bottom of the file. You may find more here.

http://msdn2.microsoft.com/en-us/library/ms649274.aspx

Edit: I have a script that takes all of the UDF's apart and creates a separate HTM file for each function. It also creates a master list of all The constants found in all the include files so if you don't mind I'll add your constants into that list.

Thanks for link.

Link to comment
Share on other sites

well, that's close. but even better is :

; Constants for Special Folders in Windows

Global Const $SF_Internet_Explorer                          = 0x1
Global Const $SF_Programs                                   = 0x2
Global Const $SF_Control_Panel                              = 0x3
Global Const $SF_Printers_and_Faxes                         = 0x4
Global Const $SF_My_Documents                               = 0x5
Global Const $SF_Favorites                                  = 0x6
Global Const $SF_Startup                                    = 0x7
Global Const $SF_My_Recent_Documents                        = 0x8
Global Const $SF_SendTo                                     = 0x9
Global Const $SF_Recycle_Bin                                = 0xa
Global Const $SF_Start_Menu                                 = 0xb
Global Const $SF_My_Music                                   = 0xd
Global Const $SF_My_Videos                                  = 0xe
Global Const $SF_Desktop                                    = 0x10
Global Const $SF_My_Computer                                = 0x11
Global Const $SF_My_Network_Places                          = 0x12
Global Const $SF_NetHood                                    = 0x13
Global Const $SF_Fonts                                      = 0x14
Global Const $SF_Templates                                  = 0x15
Global Const $SF_All_Users_Start_Menu                       = 0x16
Global Const $SF_All_Users_Programs                         = 0x17
Global Const $SF_All_Users_Startup                          = 0x18
Global Const $SF_All_Users_Desktop                          = 0x19
Global Const $SF_Application_Data                           = 0x1a
Global Const $SF_PrintHood                                  = 0x1b
Global Const $SF_Local_Settings_Application_Data            = 0x1c
Global Const $SF_All_Users_Favorites                        = 0x19
Global Const $SF_Local_Settings_Temporary_Internet_Files    = 0x20
Global Const $SF_Cookies                                    = 0x21
Global Const $SF_Local_Settings_History                     = 0x22
Global Const $SF_All_Users_Application_Data                 = 0x23
Global Const $SF_Windows                                    = 0x24
Global Const $SF_System32                                   = 0x25
Global Const $SF_Program_Files                              = 0x26
Global Const $SF_My_Pictures                                = 0x27
Global Const $SF_User_Profile                               = 0x28
Global Const $SF_Common_Files                               = 0x2b
Global Const $SF_All_Users_Templates                        = 0x2e
Global Const $SF_Administrative_Tools                       = 0x2f
Global Const $SF_Network_Connections                        = 0x31
Global Const $SF_CD_Burning_Folder                          = 0x3b

Func _Special_Folders ($i_Folder)
    $objShell = ObjCreate("Shell.Application")
    $objShell.open($objShell.NameSpace($i_Folder))
EndFunc

but i don't want to be picky.... muttley

j.

edit: the sorting by value is okay, and the prefix is recommended to create a unique constant.

Edited by jennico
Spoiler

I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.OixB7.jpgDon't forget this IP: 213.251.145.96

 

Link to comment
Share on other sites

well, that's close. but even better is :

; Constants for Special Folders in Windows

Global Const $SF_Internet_Explorer                          = 0x1
Global Const $SF_Programs                                   = 0x2
Global Const $SF_Control_Panel                              = 0x3
Global Const $SF_Printers_and_Faxes                         = 0x4
Global Const $SF_My_Documents                               = 0x5
Global Const $SF_Favorites                                  = 0x6
Global Const $SF_Startup                                    = 0x7
Global Const $SF_My_Recent_Documents                        = 0x8
Global Const $SF_SendTo                                     = 0x9
Global Const $SF_Recycle_Bin                                = 0xa
Global Const $SF_Start_Menu                                 = 0xb
Global Const $SF_My_Music                                   = 0xd
Global Const $SF_My_Videos                                  = 0xe
Global Const $SF_Desktop                                    = 0x10
Global Const $SF_My_Computer                                = 0x11
Global Const $SF_My_Network_Places                          = 0x12
Global Const $SF_NetHood                                    = 0x13
Global Const $SF_Fonts                                      = 0x14
Global Const $SF_Templates                                  = 0x15
Global Const $SF_All_Users_Start_Menu                       = 0x16
Global Const $SF_All_Users_Programs                         = 0x17
Global Const $SF_All_Users_Startup                          = 0x18
Global Const $SF_All_Users_Desktop                          = 0x19
Global Const $SF_Application_Data                           = 0x1a
Global Const $SF_PrintHood                                  = 0x1b
Global Const $SF_Local_Settings_Application_Data            = 0x1c
Global Const $SF_All_Users_Favorites                        = 0x19
Global Const $SF_Local_Settings_Temporary_Internet_Files    = 0x20
Global Const $SF_Cookies                                    = 0x21
Global Const $SF_Local_Settings_History                     = 0x22
Global Const $SF_All_Users_Application_Data                 = 0x23
Global Const $SF_Windows                                    = 0x24
Global Const $SF_System32                                   = 0x25
Global Const $SF_Program_Files                              = 0x26
Global Const $SF_My_Pictures                                = 0x27
Global Const $SF_User_Profile                               = 0x28
Global Const $SF_Common_Files                               = 0x2b
Global Const $SF_All_Users_Templates                        = 0x2e
Global Const $SF_Administrative_Tools                       = 0x2f
Global Const $SF_Network_Connections                        = 0x31
Global Const $SF_CD_Burning_Folder                          = 0x3b

Func _Special_Folders ($i_Folder)
    $objShell = ObjCreate("Shell.Application")
    $objShell.open($objShell.NameSpace($i_Folder))
EndFunc

but i don't want to be picky.... muttley

j.

Since we are getting picky here, now I have to fix yours too. (Extra white space removed and sorted)

;Constants for Special Folders in Windows

Global Const $Administrative_Tools = 0x2f
Global Const $All_Users_Application_Data = 0x23
Global Const $All_Users_Desktop = 0x19
Global Const $All_Users_Favorites = 0x19
Global Const $All_Users_Programs = 0x17
Global Const $All_Users_Start_Menu = 0x16
Global Const $All_Users_Startup = 0x18
Global Const $All_Users_Templates = 0x2e
Global Const $Application_Data = 0x1a
Global Const $CD_Burning_Folder = 0x003b
Global Const $Common_Files = 0x2b
Global Const $Control_Panel = 0x3
Global Const $Cookies = 0x21
Global Const $Desktop = 0x10
Global Const $Favorites = 0x6
Global Const $Fonts = 0x14
Global Const $Internet_Explorer = 0x1
Global Const $Local_Settings_Application_Data = 0x1c
Global Const $Local_Settings_History = 0x22
Global Const $Local_Settings_Temporary_Internet_Files = 0x20
Global Const $My_Computer = 0x11
Global Const $My_Documents = 0x5
Global Const $My_Music = 0xd
Global Const $My_Network_Places = 0x12
Global Const $My_Pictures = 0x27
Global Const $My_Recent_Documents = 0x8
Global Const $My_Videos = 0xe
Global Const $NetHood = 0x13
Global Const $Network_Connections = 0x31
Global Const $Printers_and_Faxes = 0x4
Global Const $PrintHood = 0x1b
Global Const $Program_Files = 0x26
Global Const $Programs = 0x2
Global Const $Recycle_Bin = 0xa
Global Const $SendTo = 0x9
Global Const $Start_Menu = 0xb
Global Const $Startup = 0x7
Global Const $System32 = 0x25
Global Const $Templates = 0x15
Global Const $User_Profile = 0x28
Global Const $Windows = 0x24

Func _Special_Folders ($i_Folder)
   $objShell = ObjCreate("Shell.Application")
   $objShell.open($objShell.NameSpace($i_Folder))
EndFunc
;

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

nonononono !!! you forgot about the prefixes. muttley and the tabs don't work when you paste them to here.

j.

edit: i think we have a version for everyone now.

Edited by jennico
Spoiler

I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.OixB7.jpgDon't forget this IP: 213.251.145.96

 

Link to comment
Share on other sites

nonononono !!! you forgot about the prefixes. muttley and the tabs don't work when you paste them to here.

j.

I see now. And don't use tabs. Use spaces. This is the last time. Variable names are upper case to satisfy the AutoIt convention purists.

;
; Constants for Special Folders in Windows

Global Const $SF_ALL_USERS_APPLICATION_DATA = 0x23
Global Const $SF_ALL_USERS_DESKTOP = 0x19
Global Const $SF_ALL_USERS_FAVORITES = 0x19
Global Const $SF_ALL_USERS_PROGRAMS = 0x17
Global Const $SF_ALL_USERS_START_MENU = 0x16
Global Const $SF_ALL_USERS_STARTUP = 0x18
Global Const $SF_ALL_USERS_TEMPLATES = 0x2E
Global Const $SF_APPLICATION_DATA = 0x1A
Global Const $SF_CD_BURNING_FOLDER = 0x003B
Global Const $SF_COMMON_FILES = 0x2B
Global Const $SF_CONTROL_PANEL = 0x3
Global Const $SF_COOKIES = 0x21
Global Const $SF_DESKTOP = 0x10
Global Const $SF_ENDFUNC
Global Const $SF_FAVORITES = 0x6
Global Const $SF_FONTS = 0x14
Global Const $SF_INTERNET_EXPLORER = 0x1
Global Const $SF_LOCAL_SETTINGS_APPLICATION_DATA = 0x1C
Global Const $SF_LOCAL_SETTINGS_HISTORY = 0x22
Global Const $SF_LOCAL_SETTINGS_TEMPORARY_INTERNET_FILES = 0x20
Global Const $SF_MY_COMPUTER = 0x11
Global Const $SF_MY_DOCUMENTS = 0x5
Global Const $SF_MY_MUSIC = 0xD
Global Const $SF_MY_NETWORK_PLACES = 0x12
Global Const $SF_MY_PICTURES = 0x27
Global Const $SF_MY_RECENT_DOCUMENTS = 0x8
Global Const $SF_MY_VIDEOS = 0xE
Global Const $SF_NETHOOD = 0x13
Global Const $SF_NETWORK_CONNECTIONS = 0x31
Global Const $SF_PRINTERS_AND_FAXES = 0x4
Global Const $SF_PRINTHOOD = 0x1B
Global Const $SF_PROGRAM_FILES = 0x26
Global Const $SF_PROGRAMS = 0x2
Global Const $SF_RECYCLE_BIN = 0xA
Global Const $SF_SENDTO = 0x9
Global Const $SF_START_MENU = 0xB
Global Const $SF_STARTUP = 0x7
Global Const $SF_SYSTEM32 = 0x25
Global Const $SF_TEMPLATES = 0x15
Global Const $SF_USER_PROFILE = 0x28
Global Const $SF_WINDOWS = 0x24

Func _Special_Folders ($i_Folder)
   $objShell = ObjCreate("Shell.Application")
   $objShell.open($objShell.NameSpace($i_Folder))
EndFunc
;

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Here's a version I did some time ago with the SHGetFolderPath() and SHGetKnownFolderPath() functions.

#cs
HRESULT SHGetFolderPath(
    HWND hwndOwner,
    int nFolder,
    HANDLE hToken,
    DWORD dwFlags,
    LPTSTR pszPath
)

HRESULT SHGetKnownFolderPath(
    REFKNOWNFOLDERID rfid,
    DWORD dwFlags,
    HANDLE hToken,
    PWSTR *ppszPath
)
#ce

#include-once
#include <WinAPI.au3>

;*********************************************************
;* SHGetFolderPath Global Constants                             *
;* combine Global Constants using BitOR()                       *
;*********************************************************
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_MYDOCUMENTS = 0x000C
Global Const $CSIDL_MYMUSIC = 0x000D
Global Const $CSIDL_MYVIDEO = 0x000E
Global Const $CSIDL_DIRECTORY = 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 = 0x016
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_LOCAL_APPDATA = 0x001C
Global Const $CSIDL_ALTSTARTUP = 0x001D
Global Const $CSIDL_COMMON_ALTSTARTUP = 0x001E
Global Const $CSIDL_COMMON_FAVORITES = 0x001F
Global Const $CSIDL_INTERNET_CACHE = 0x0020
Global Const $CSIDL_COOKIES = 0x0021
Global Const $CSIDL_HISTORY = 0x0022
Global Const $CSIDL_COMMON_APPDATA = 0x0023
Global Const $CSIDL_WINDOWS = 0x0024
Global Const $CSIDL_SYSTEM = 0x0025
Global Const $CSIDL_PROGRAM_FILES = 0x0026
Global Const $CSIDL_MYPICTURES = 0x0027
Global Const $CSIDL_PROFILE = 0x0028
Global Const $CSIDL_SYSTEMX86 = 0x0029
Global Const $CSIDL_PROGRAM_FILESX86 = 0x002A
Global Const $CSIDL_PROGRAM_FILES_COMMON = 0x002B
Global Const $CSIDL_PROGRAM_FILES_COMMONX86 = 0x002C
Global Const $CSIDL_COMMON_TEMPLATES = 0x002D
Global Const $CSIDL_COMMON_DOCUMENTS = 0x002E
Global Const $CSIDL_COMMON_ADMINTOOLS = 0x002F
Global Const $CSIDL_ADMINTOOLS = 0x0030
Global Const $CSIDL_CONNECTIONS = 0x0031
Global Const $CSIDL_COMMON_MUSIC = 0x0035
Global Const $CSIDL_COMMON_PICTURES = 0x0036
Global Const $CSIDL_COMMON_VIDEO = 0x0037
Global Const $CSIDL_RESOURCES = 0x0038
Global Const $CSIDL_RESOURCES_LOCALIZED = 0x0039
Global Const $CSIDL_COMMON_OEM_LINKS = 0x003A
Global Const $CSIDL_CDBURN_AREA = 0x003B
Global Const $CSIDL_COMPUTERSNEARME = 0x003D

; combine with CSIDL_ value to force folder creation in SHGetFolderPath()
Global Const $CSIDL_FLAG_CREATE = 0x8000
; combine with CSIDL_ value to return an unverified folder path
Global Const $CSIDL_FLAG_DONT_VERIFY = 0x4000
; combine with CSIDL_ value to insure non-alias versions of the pidl
Global Const $CSIDL_FLAG_NO_ALIAS = 0x1000
; combine with CSIDL_ value to indicate per-user init (eg. upgrade)
Global Const $CSIDL_FLAG_PER_USER_INIT = 0x0800
; mask for all possible flag values
Global Const $CSIDL_FLAG_MASK = 0xFF00

; dwFlags values for use with SHGetFolderPath
; current value for user, verify it exists
Global Const $SHGFP_TYPE_CURRENT = 0x0000
; default value
Global Const $SHGFP_TYPE_DEFAULT = 0x0001

;*********************************************************
;* SHGetKnownFolderPath Global Constants                        *
;* combine Global Constants using BitOR()                       *
;*********************************************************
Global Const $FOLDERID_AddNewPrograms = "{de61d971-5ebc-4f02-a3a9-6c82895e5c04}"
Global Const $FOLDERID_AdminTools  = "{724EF170-A42D-4FEF-9F26-B60E846FBA4F}"
Global Const $FOLDERID_AppUpdates = "{a305ce99-f527-492b-8b1a-7e76fa98d6e4}"
Global Const $FOLDERID_CDBurning = "{9E52AB10-F80D-49DF-ACB8-4330F5687855}"
Global Const $FOLDERID_ChangeRemovePrograms = "{df7266ac-9274-4867-8d55-3bd661de872d}"
Global Const $FOLDERID_CommonAdminTools = "{D0384E7D-BAC3-4797-8F14-CBA229B392B5}"
Global Const $FOLDERID_CommonOEMLinks = "{C1BAE2D0-10DF-4334-BEDD-7AA20B227A9D}"
Global Const $FOLDERID_CommonPrograms = "{0139D44E-6AFE-49F2-8690-3DAFCAE6FFB8}"
Global Const $FOLDERID_CommonstartMenu = "{A4115719-D62E-491D-AA7C-E74B8BE3B067}"
Global Const $FOLDERID_Commonstartup = "{82A5EA35-D9CD-47C5-9629-E15D2F714E6E}"
Global Const $FOLDERID_CommonTemplates = "{B94237E7-57AC-4347-9151-B08C6C32D1F7}"
Global Const $FOLDERID_ComputerFolder = "{0AC0837C-BBF8-452A-850D-79D08E667CA7}"
Global Const $FOLDERID_ConflictFolder = "{4bfefb45-347d-4006-a5be-ac0cb0567192}"
Global Const $FOLDERID_ConnectionsFolder = "{6F0CD92B-2E97-45D1-88FF-B0D186B8DEDD}"
Global Const $FOLDERID_Contact = "{56784854-C6CB-462b-8169-88E350ACB882}"
Global Const $FOLDERID_ControlPanelFolder = "{82A74AEB-AEB4-465C-A014-D097EE346D63}"
Global Const $FOLDERID_Cookies = "{2B0F765D-C0E9-4171-908E-08A611B84FF6}"
Global Const $FOLDERID_Desktop = "{B4BFCC3A-DB2C-424C-B029-7FE99A87C641}"
Global Const $FOLDERID_Documents = "{FDD39AD0-238F-46AF-ADB4-6C85480369C7}"
Global Const $FOLDERID_Downloads = "{374DE290-123F-4565-9164-39C4925E467B}"
Global Const $FOLDERID_Favorites = "{1777F761-68AD-4D8A-87BD-30B759FA33DD}"
Global Const $FOLDERID_Fonts = "{FD228CB7-AE11-4AE3-864C-16F3910AB8FE}"
Global Const $FOLDERID_Games = "{CAC52C1A-B53D-4edc-92D7-6B2E8AC19434}"
Global Const $FOLDERID_GameTasks = "{054FAE61-4DD8-4787-80B6-090220C4B700}"
Global Const $FOLDERID_History = "{D9DC8A3B-B784-432E-A781-5A1130A75963}"
Global Const $FOLDERID_InternetCache = "{352481E8-33BE-4251-BA85-6007CAEDCF9D}"
Global Const $FOLDERID_InternetFolder = "{4D9F7874-4E0C-4904-967B-40B0D20C3E4B}"
Global Const $FOLDERID_Links = "{bfb9d5e0-c6a9-404c-b2b2-ae6db6af4968}"
Global Const $FOLDERID_LocalAppData = "{F1B32785-6FBA-4FCF-9D55-7B8E7F157091}"
Global Const $FOLDERID_LocalAppDataLow = "{A520A1A4-1780-4FF6-BD18-167343C5AF16}"
Global Const $FOLDERID_LocalizedResourcesDir = "{2A00375E-224C-49DE-B8D1-440DF7EF3DDC}"
Global Const $FOLDERID_Music = "{4BD8D571-6D19-48D3-BE97-422220080E43}"
Global Const $FOLDERID_NetHood = "{C5ABBF53-E17F-4121-8900-86626FC2C973}"
Global Const $FOLDERID_NetworkFolder = "{D20BEEC4-5CA8-4905-AE3B-BF251EA09B53}"
Global Const $FOLDERID_OriginalImages = "{2C36C0AA-5812-4b87-BFD0-4CD0DFB19B39}"
Global Const $FOLDERID_PhotoAlbums = "{69D2CF90-FC33-4FB7-9A0C-EBB0F0FCB43C}"
Global Const $FOLDERID_Pictures = "{33E28130-4E1E-4676-835A-98395C3BC3BB}"
Global Const $FOLDERID_Playlists = "{DE92C1C7-837F-4F69-A3BB-86E631204A23}"
Global Const $FOLDERID_PrintersFolder = "{76FC4E2D-D6AD-4519-A663-37BD56068185}"
Global Const $FOLDERID_PrintHood = "{9274BD8D-CFD1-41C3-B35E-B13F55A758F4}"
Global Const $FOLDERID_Profile = "{5E6C858F-0E22-4760-9AFE-EA3317B67173}"
Global Const $FOLDERID_ProgramData = "{62AB5D82-FDC1-4DC3-A9DD-070D1D495D97}"
Global Const $FOLDERID_ProgramFiles = "{905e63b6-c1bf-494e-b29c-65b732d3d21a}"
Global Const $FOLDERID_ProgramFilesX64 = "{6D809377-6AF0-444b-8957-A3773F02200E}"
Global Const $FOLDERID_ProgramFilesX86 = "{7C5A40EF-A0FB-4BFC-874A-C0F2E0B9FA8E}"
Global Const $FOLDERID_ProgramFilesCommon = "{F7F1ED05-9F6D-47A2-AAAE-29D317C6F066}"
Global Const $FOLDERID_ProgramFilesCommonX64 = "{6365D5A7-0F0D-45E5-87F6-0DA56B6A4F7D}"
Global Const $FOLDERID_ProgramFilesCommonX86 = "{DE974D24-D9C6-4D3E-BF91-F4455120B917}"
Global Const $FOLDERID_Programs = "{A77F5D77-2E2B-44C3-A6A2-ABA601054A51}"
Global Const $FOLDERID_Public = "{DFDF76A2-C82A-4D63-906A-5644AC457385}"
Global Const $FOLDERID_PublicDesktop = "{C4AA340D-F20F-4863-AFEF-F87EF2E6BA25}"
Global Const $FOLDERID_PublicDocuments = "{ED4824AF-DCE4-45A8-81E2-FC7965083634}"
Global Const $FOLDERID_PublicDownloads = "{3D644C9B-1FB8-4f30-9B45-F670235F79C0}"
Global Const $FOLDERID_PublicGameTasks = "{DEBF2536-E1A8-4c59-B6A2-414586476AEA}"
Global Const $FOLDERID_PublicMusic = "{3214FAB5-9757-4298-BB61-92A9DEAA44FF}"
Global Const $FOLDERID_PublicPictures = "{B6EBFB86-6907-413C-9AF7-4FC2ABF07CC5}"
Global Const $FOLDERID_PublicVideos = "{2400183A-6185-49FB-A2D8-4A392A602BA3}"
Global Const $FOLDERID_QuickLaunch = "{52a4f021-7b75-48a9-9f6b-4b87a210bc8f}"
Global Const $FOLDERID_Recent = "{AE50C081-EBD2-438A-8655-8A092E34987A}"
Global Const $FOLDERID_RecycleBinFolder = "{B7534046-3ECB-4C18-BE4E-64CD4CB7D6AC}"
Global Const $FOLDERID_ResourceDir = "{8AD10C31-2ADB-4296-A8F7-E4701232C972}"
Global Const $FOLDERID_RoamingAppData = "{3EB685DB-65F9-4CF6-A03A-E3EF65729F3D}"
Global Const $FOLDERID_SampleMusic = "{B250C668-F57D-4EE1-A63C-290EE7D1AA1F}"
Global Const $FOLDERID_SamplePictures = "{C4900540-2379-4C75-844B-64E6FAF8716B}"
Global Const $FOLDERID_SamplePlaylists = "{15CA69B3-30EE-49C1-ACE1-6B5EC372AFB5}"
Global Const $FOLDERID_SampleVideos = "{859EAD94-2E85-48AD-A71A-0969CB56A6CD}"
Global Const $FOLDERID_SavedGames = "{4C5C32FF-BB9D-43b0-B5B4-2D72E54EAAA4}"
Global Const $FOLDERID_SavedSearches = "{7d1d3a04-debb-4115-95cf-2f29da2920da}"
Global Const $FOLDERID_SEARCH_CSC = "{ee32e446-31ca-4aba-814f-a5ebd2fd6d5e}"
Global Const $FOLDERID_SEARCH_MAPI = "{98ec0e18-2098-4d44-8644-66979315a281}"
Global Const $FOLDERID_SearchHome = "{190337d1-b8ca-4121-a639-6d472d16972a}"
Global Const $FOLDERID_SendTo = "{8983036C-27C0-404B-8F08-102D10DCFD74}"
Global Const $FOLDERID_SidebarDefaultParts = "{7B396E54-9EC5-4300-BE0A-2482EBAE1A26}"
Global Const $FOLDERID_SidebarParts = "{A75D362E-50FC-4fb7-AC2C-A8BEAA314493}"
Global Const $FOLDERID_StartMenu = "{625B53C3-AB48-4EC1-BA1F-A1EF4146FC19}"
Global Const $FOLDERID_Startup = "{B97D20BB-F46A-4C97-BA10-5E3608430854}"
Global Const $FOLDERID_SyncManagerFolder = "{43668BF8-C14E-49B2-97C9-747784D784B7}"
Global Const $FOLDERID_SyncResultsFolder = "{289a9a43-be44-4057-a41b-587a76d7e7f9}"
Global Const $FOLDERID_SyncSetupFolder = "{0F214138-B1D3-4a90-BBA9-27CBC0C5389A}"
Global Const $FOLDERID_System = "{1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}"
Global Const $FOLDERID_SystemX86 = "{D65231B0-B2F1-4857-A4CE-A8E7C6EA7D27}"
Global Const $FOLDERID_Templates = "{A63293E8-664E-48DB-A079-DF759E0509F7}"
Global Const $FOLDERID_TreeProperties = "{5b3749ad-b49f-49c1-83eb-15370fbd4882}"
Global Const $FOLDERID_UserProfiles = "{0762D272-C50A-4BB0-A382-697DCD729B80}"
Global Const $FOLDERID_UsersFiles = "{f3ce0f7c-4901-4acc-8648-d5d44b04ef8f}"
Global Const $FOLDERID_Videos = "{18989B1D-99B5-455B-841C-AB7C74E4DDFC}"
Global Const $FOLDERID_Windows = "{F38BF404-1D43-42F2-9305-67DE0B28FC23}"

; KF_FLAG_ dwFlags values for use with SHGetKnownFolderPath
; force creation of the specified folder if it does not exist
Global Const $KF_FLAG_CREATE = 0x8000
; specifies not to verify the folder's existence before attempting to retrieve the path or IDList
Global Const $KF_FLAG_DONT_VERIFY = 0x4000
; gets the true system path for the folder, free of any aliased placeholders
Global Const $KF_FLAG_NO_ALIAS = 0x1000
; initializes the folder using its Desktop.ini settings
Global Const $KF_FLAG_INIT = 0x0800
; gets the default path for a known folder that is redirected elsewhere
Global Const $KF_FLAG_DEFAULT_PATH = 0x0400
; gets the folder's default path independent of the current location of its parent
Global Const $KF_FLAG_NOT_PARENT_RELATIVE = 0x0200
; build a simple pointer to an item identifier list (PIDL)
Global Const $KF_FLAG_SIMPLE_IDLIST = 0x0100

Func _WinAPI_SHGetFolderPath($nFolder, $dwFlags = $SHGFP_TYPE_CURRENT)
    Local $path = DllStructCreate("wchar[260]")
    Local $folder = DllCall("shell32.dll", "int", "SHGetFolderPathW", _
                                            "hwnd", 0, _
                                            "int", $nFolder, _
                                            "ptr", 0, _
                                            "dword", $dwFlags, _
                                            "ptr", DllStructGetPtr($path) _
                                            )
    If $folder[0] < 0 Then Return SetError(1, "", "")
    Return DllStructGetData($path, 1)
EndFunc

Func _WinAPI_SHGetKnownFolderPath($rfid, $dwFlags = $KF_FLAG_NO_ALIAS)
    Local $tagstruct, $pathptr, $pathstruct, $path
    $tagstruct = DllStructCreate($tagGUID)
    _WinAPI_GUIDFromStringEx($rfid, DllStructGetPtr($tagstruct))
    $pathptr = DllCall("shell32.dll", "int", "SHGetKnownFolderPath", _
                                        "ptr", DllStructGetPtr($tagstruct), _
                                        "dword", $dwFlags, _
                                        "ptr", 0, _
                                        "ptr*", 0 _
                                        )
    If $pathptr[0] <> 0 Then Return SetError(1, "", "")
    $pathstruct = DllStructCreate("wchar[260]", $pathptr[4])
    $path = DllStructGetData($pathstruct, 1)

    DllCall("ole32.dll", "none", "CoTaskMemFree", _
                            "ptr", $pathptr[4] _
                            )
    Return $path
EndFunc
Edited by wraithdu
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...