UDF > WinAPIEx > ShellEx >


_WinAPI_ShellGetSetFolderCustomSettings

Définit ou obtient les paramètres d'un dossier personnalisé

#include <WinAPIShellEx.au3>
_WinAPI_ShellGetSetFolderCustomSettings ( $sFilePath, $iFlag, ByRef $tSHFCS )

Paramètres

$sFilePath Le chemin d'accès au dossier.
$iFlag Un flag controlant l'action de la fonction. Il peut prendre l'une des valeurs suivantes:
$FCS_READ
$FCS_FORCEWRITE
$FCS_WRITE
$tSHFCS La structure $tagSHFOLDERCUSTOMSETTINGS qui fournit ou reçoit les paramètres du dossier personnalisé. Cette structure doit être créée avant l'appel de la fonction.

Valeur de retour

Succès: Retourne 1.
Échec: Retourne 0 et définit @error <> 0, @extended peut contenir le code d'erreur HRESULT.

Remarque

Cette fonction lit et écrit dans Desktop.ini.

Voir aussi

Consultez SHGetSetFolderCustomSettings dans la librairie MSDN.

Exemple

#include <APIShellExConstants.au3>
#include <WinAPIDlg.au3>
#include <WinAPIShellEx.au3>

; Sélectionne un dossier
Local $sPath = FileSelectFolder('Choisissez un dossier', '', 0, @ScriptDir)
If Not $sPath Then
    Exit
EndIf

; Sélectionne l'icône
Local $aIcon = _WinAPI_PickIconDlg()
If @error Then Exit

; Définit l'icône pour le dossier sélectionné
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)