Les Snippets

Connexion

Obtenir le chemin d'accès pour le dossier Mes Documents

Niveau requis pour utiliser/comprendre cette source : 1 ( Débutant )
Créé le 18/06/2006 16:55:05 et initié par fabrice69 [Liste]
Date de mise à jour : 18/06/2006 18:55:51
Vue : 11876
Catégorie(s) : Fichier / Disque
Langages dispo pour ce code :
- C# 2.x
- C# 1.x
- VB.NET 1.x
- VB 2005
- Windev
- VB6
- Delphi 5



Langage : C# 2.x
Date ajout : 18/06/2006
Posté par fabrice69 [Liste]
DateMAJ : 18/06/2006

string MyDocumentFolder = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);

Remarque :
Fonctionne avec le FrameWork 2.0
Langage : C# 1.x
Date ajout : 18/06/2006
Posté par fabrice69 [Liste]

string MyDocumentFolder = Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);

Langage : VB.NET 1.x
Date ajout : 18/06/2006
Posté par fabrice69 [Liste]

Dim MyDocumentFolder As String = Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);

Langage : VB 2005
Date ajout : 18/06/2006
Posté par fabrice69 [Liste]
DateMAJ : 18/06/2006

Dim MyDocumentFolder As String = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);

Langage : Windev
Date ajout : 18/06/2006
Posté par Elian Lacroix [Liste]
sRepDocuments est une chaine = SysRep(srMesDocuments)
Info("Le répertoire 'Mes Documents' est : "+sRepDocuments)
Langage : VB6
Date ajout : 08/07/2006
Posté par PCPT [Liste]
'   Copiez ce code sur une Form
'
Option Explicit 
'
Private Const CSIDL_PERSONAL As Long = &H5 
'
Private Type SHITEMID 
    cb As Long 
    abID As Byte 
End Type 
'
Private Type ITEMIDLIST 
    mkid As SHITEMID 
End Type 
'
Private Declare Function SHGetSpecialFolderLocation Lib "shell32.dll" _ 
                        (ByVal hwndOwner As LongByVal nFolder As Long, _ 
                         pidl As ITEMIDLIST) As Long 
Private Declare Function SHGetPathFromIDList Lib "shell32.dll" Alias "SHGetPathFromIDListA" _ 
                        (ByVal pidl As LongByVal pszPath As StringAs Long 
'
'
Private Sub Form_Load() 
    MsgBox GetMyDocumentsFolder 
    Unload Me 
End Sub 
'
'
Private Function GetMyDocumentsFolder() As String 
    Dim lRet As Long, IDL As ITEMIDLIST, sPath As String 
    lRet = SHGetSpecialFolderLocation(100&, CSIDL_PERSONAL, IDL) 
    If lRet = 0 Then 
        sPath = String$(512, Chr$(0)) 
        lRet = SHGetPathFromIDList(ByVal IDL.mkid.cb, ByVal sPath) 
        GetMyDocumentsFolder = Left$(sPath, InStr(sPath, Chr$(0)) - 1) 
    Else 
        GetMyDocumentsFolder = vbNullString 
    End If 
End Function
Langage : Delphi 5
Date ajout : 22/02/2007
Posté par cirec [Liste]
{Voici la fonction qui permet de retrouver un repertoire d'après sa valeur CSIDL
 nescessite l'utilisation dans les Uses de l'unité ShlObj}
Function GetFolder(CSIDLValue: integer): String;
Var
  IdList            : PITEMIDLIST;
  Folder            : Array[0..MAX_PATH] Of Char;
Begin
  if Not Failed(SHGetSpecialFolderLocation(0, CSIDLValue, IdList)) then
    Begin
      SHGetPathFromIDList(IdList, Folder);
      Result := Folder;
    End;
End;
{Utilisation pour : Obtenir le chemin d'accès pour le dossier Mes Documents}
procedure TForm1.Button1Click(Sender: TObject);
begin
  Label1.Caption := GetFolder(CSIDL_PERSONAL);
end;


Snippets en rapport avec : Chemin, Mes documents, Dossiers utilisateurs



Codes sources en rapport avec : Chemin, Mes documents, Dossiers utilisateurs

{Visual Basic, VB6, VB.NET, VB 2005} AFFICHAGE DU CHEMIN D'UN MESSAGE OUTLOOK
Lorsque l'on effectue une recheche avancée de message sous outlook 2003 il n'est pas possible d'acce...

{PHP} DÉTERMINATION DU CHEMIN D'INDEXAGE MENANT À UNE VALEUR DANS UN TABLEAU MULTI-DIMENSIONNEL
Cette fonction sert à trouver tous les indices qu'il faut suivre dans un tableau multidimentionnel p...

{C / C++ / C++.NET} CONVERTIR CHEMIN RELATIF EN CHEMIN ABSOLUE (POUR DISQUE DUR)
ce code est un complement de l'utilisation de GetFullPathName() qui necessite un fichier existant ...

{Visual Basic, VB6, VB.NET, VB 2005} PATHFIND ASTAR : RECHERCHE DU CHEMIN LE PLUS COURS ENTRE DEUX POINTS
Dans le monde de l'infographie, il arrive forcément un moment où l'on doit mettre un objet en mouvem...

{Visual Basic, VB6, VB.NET, VB 2005} RECHERCHE D'UN CHEMIN POSSIBLE ENTRE 2 POINTS AVEC DIAGRAMME ASTAR
Ce programme recherche un chemin possible entre 2 points à l'aide du diagramme AStar et il trouve l'...

{Visual Basic, VB6, VB.NET, VB 2005} ALGORITHME DE PATHFINDING ASTAR
Cet algorithme célèbre est un algorithme de type PathFinding. Il recherche le chemin le plus rap...

{Delphi} ASTAR - A* RECHERCHE DU PLUS COURT CHEMIN
bonjour, je poste la source d'un A* codé l'an passé. C'était mon premier programme donc je me suis...

{PHP} INCLUDE CONTENANT DES IMAGES ET AUTRES FICHIERS
En créant un site, on a tendance à faire des includes de fichiers contenant le haut du site ou le ba...

{C# / C#.NET} BIBLIOTHÈQUE D'IMPLÉMENTATION D'ALGORITHMES DE RECHERCHE OPÉRATIONNELLE
Bonjour Pour l'instant seuls deux algorithmes sont implémentés, ceux de recherche extrémale (maxima...

{Assembleur} MANIPULER LES CHEMINS,WINDOWS,DOS,SYSTÈMES..
Il vous permet de récupérer n'importe quel chemin (en texte) depuis l'explorateur.Placer un racou...