Sets or retrieves custom folder settings
#include <WinAPIShellEx.au3>
_WinAPI_ShellGetSetFolderCustomSettings ( $sFilePath, $iFlag, ByRef $tSHFCS )
$sFilePath | The path to the folder. |
$iFlag | A flag controlling the action of the function. It may be one of the following values. $FCS_READ $FCS_FORCEWRITE $FCS_WRITE |
$tSHFCS | $tagSHFOLDERCUSTOMSETTINGS structure that provides or receives the custom folder settings. This structure must be created before function call. |
Success: | 1. |
Failure: | 0 and sets the @error flag to non-zero, @extended flag may contain the HRESULT error code. |
This function reads from and writes to Desktop.ini.
Search SHGetSetFolderCustomSettings in MSDN Library.
#include <APIShellExConstants.au3>
#include <WinAPIDlg.au3>
#include <WinAPIShellEx.au3>
; Select folder
Local $sPath = FileSelectFolder('Select Folder', '', 0, @ScriptDir)
If Not $sPath Then
Exit
EndIf
; Select icon
Local $aIcon = _WinAPI_PickIconDlg()
If @error Then Exit
; Set icon to selected folder
Local $tSHFCS = DllStructCreate($tagSHFOLDERCUSTOMSETTINGS & ';wchar szIconFile[' & (StringLen($aIcon[0]) + 1) & ']')
DllStructSetData($tSHFCS, 'Size', DllStructGetPtr($tSHFCS, 'szIconFile') - DllStructGetPtr($tSHFCS))
DllStructSetData($tSHFCS, 'Mask', $FCSM_ICONFILE)
DllStructSetData($tSHFCS, 'IconFile', DllStructGetPtr($tSHFCS, 'szIconFile'))
DllStructSetData($tSHFCS, 'SizeIF', 260)
DllStructSetData($tSHFCS, 'IconIndex', $aIcon[1])
DllStructSetData($tSHFCS, 'szIconFile', $aIcon[0])
_WinAPI_ShellGetSetFolderCustomSettings($sPath, $FCS_FORCEWRITE, $tSHFCS)