Commondialog et dossier !!!

cs_RaZoR Messages postés 102 Date d'inscription vendredi 22 février 2002 Statut Membre Dernière intervention 22 décembre 2003 - 19 janv. 2003 à 19:19
gmni Messages postés 91 Date d'inscription mercredi 6 novembre 2002 Statut Membre Dernière intervention 20 mars 2009 - 14 mars 2003 à 00:55
Je voudrais savoir comment on fais pour ,avec un commondialog, pouvoir sélectionner un DOSSIER !!!

Merci

2 réponses

clementio Messages postés 432 Date d'inscription samedi 18 mai 2002 Statut Membre Dernière intervention 17 février 2014 1
19 janv. 2003 à 22:03
Avec un commondialogbox tu peux pas mais essaie ça:

Private Declare Function SHGetPathFromIDList Lib "shell32.dll" Alias "SHGetPathFromIDListA" (ByVal pidl As Long, ByVal pszPath As String) As Long
Private Declare Function SHBrowseForFolder Lib "shell32.dll" Alias "SHBrowseForFolderA" (lpBrowseInfo As BROWSEINFO) As Long

Private Const BIF_RETURNONLYFSDIRS = &H1

Private Type BROWSEINFO
hOwner As Long
pidlRoot As Long
pszDisplayName As String
lpszTitle As String
ulFlags As Long
lpfn As Long
lParam As Long
iImage As Long
End Type

Private Sub Command1_Click()
Dim X As BROWSEINFO
Dim Chemin As String
Dim pidl As Long
Dim RetVal As Long
Dim p As Integer

X.hOwner = Me.hwnd
X.pidlRoot = 0&
X.lpszTitle = "Selectionnez le dossier où commencer la recherche"
X.ulFlags = BIF_RETURNONLYFSDIRS
pidl& = SHBrowseForFolder(X)

Chemin = String(512, 0)
RetVal = SHGetPathFromIDList(pidl&, Chemin)
If RetVal Then
p = InStr(Chemin, Chr$(0))
Text1 = Left(Chemin, p - 1)
End If
End Sub
0
gmni Messages postés 91 Date d'inscription mercredi 6 novembre 2002 Statut Membre Dernière intervention 20 mars 2009
14 mars 2003 à 00:55
Merci pour ce script que j'ai cherché longtemps. Tres utile sans passer par une oxc; une future source ?
a+
0
Rejoignez-nous