UDF > WinAPIEx > ShellEx >


_WinAPI_ShellGetSpecialFolderPath

Obtient le chemin d'un dossier spécial

#include <WinAPIShellEx.au3>
_WinAPI_ShellGetSpecialFolderPath ( $iCSIDL [, $bCreate = False] )

Paramètres

$iCSIDL La CSIDL ($iCSIDL_*) qui identifie le dossier qui vous intéresse.
$bCreate [optionnel] Indique si le dossier doit être créé s'il n'existe pas déjà, les valeurs possibles sont:
True - Le dossier est créé.
False - Le dossier n'est pas créé (par défaut).

Valeur de retour

Succès: Retourne le chemin complet du dossier spécial.
Échec: Retourne la chaîne vide et définit @error <> 0.

Voir aussi

Consultez SHGetSpecialFolderPath dans la librairie MSDN.

Exemple

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

ConsoleWrite('Windows => ' & _WinAPI_ShellGetSpecialFolderPath($CSIDL_WINDOWS) & @CRLF)
ConsoleWrite('System => ' & _WinAPI_ShellGetSpecialFolderPath($CSIDL_SYSTEM) & @CRLF)
ConsoleWrite('Fonts => ' & _WinAPI_ShellGetSpecialFolderPath($CSIDL_FONTS) & @CRLF)
ConsoleWrite('Program Files => ' & _WinAPI_ShellGetSpecialFolderPath($CSIDL_PROGRAM_FILES) & @CRLF)
ConsoleWrite('Profile => ' & _WinAPI_ShellGetSpecialFolderPath($CSIDL_PROFILE) & @CRLF)
ConsoleWrite('My Documents => ' & _WinAPI_ShellGetSpecialFolderPath($CSIDL_PERSONAL) & @CRLF)
ConsoleWrite('Start Menu => ' & _WinAPI_ShellGetSpecialFolderPath($CSIDL_STARTMENU) & @CRLF)
ConsoleWrite('Favorites => ' & _WinAPI_ShellGetSpecialFolderPath($CSIDL_FAVORITES) & @CRLF)
ConsoleWrite('Desktop => ' & _WinAPI_ShellGetSpecialFolderPath($CSIDL_DESKTOP) & @CRLF)

ConsoleWrite('Invalid CSIDL => "' & _WinAPI_ShellGetSpecialFolderPath(-1) & '" @error = ' & @error & '@extended = 0x' & Hex(@extended) & @CRLF)