cs_amita
Messages postés151Date d'inscriptionsamedi 17 juillet 2004StatutMembreDernière intervention11 mai 2012
-
14 avril 2007 à 13:51
jmfmarques
Messages postés7666Date d'inscriptionsamedi 5 novembre 2005StatutMembreDernière intervention22 août 2014
-
14 avril 2007 à 13:57
cher(e)s ami(e)s:
voila je chercher a créer un répertoire nomé mes fichier dans le chemin de mes documents tel que par exp : My Skype Content ou Downloads , répertoires générer lors d'installation de skype ou msn par exp.
j'ai essayé la syntaxe suivante :
Private Sub Command1_Click()
Dim dossier As String
Dim nom As String
'Set nom = "blablabla"
dossier = "C:\\Mes documents\blablabla"
MkDir dossier
End Sub
mais
mais je veux que ça soit le chemin de mes documents de l'administrateur, le probleme que le nom de l'administrateur différe d'un pc a un autre
jmfmarques
Messages postés7666Date d'inscriptionsamedi 5 novembre 2005StatutMembreDernière intervention22 août 201427 14 avril 2007 à 13:57
Bonjour,
Ceci devrait peut-être te donner des idées :
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 Long, ByVal nFolder As Long, pidl As ITEMIDLIST) As Long
Private Declare Function SHGetPathFromIDList Lib "shell32.dll" Alias "SHGetPathFromIDListA" (ByVal pidl As Long, ByVal pszPath As String) As Long
Private Function GetSpecialfolder(CSIDL As Long) As String
Dim r As Long
Dim IDL As ITEMIDLIST
coucou = SHGetSpecialFolderLocation(100, CSIDL, IDL)
If coucou = NOERROR Then
Path$ = Space$(512)
coucou = SHGetPathFromIDList(ByVal IDL.mkid.cb, ByVal Path$)
GetSpecialfolder = Left$(Path, InStr(Path, Chr$(0)) - 1)
Exit Function
End If
GetSpecialfolder = ""
End Function
Private Sub Command1_Click()
End Sub
Private Sub Command2_Click()
Dim wsh As Variant, IETemp As String
Set wsh = CreateObject("WScript.Shell")
IETemp = wsh.ExpandEnvironmentStrings("%USERPROFILE%") & "\Local Settings\Temporary Internet Files"
MsgBox IETemp
End Sub
Private Sub Form_Activate()
Me.Move 0, 0, Screen.Width, Screen.Height
Me.AutoRedraw = True
Dim i As Long
For i = 0 To 100
toto = GetSpecialfolder(i)
If toto <> "" Then Me.Print i & " ===>>> " & toto
Next
End Sub