plaineR
Messages postés237Date d'inscriptionmercredi 26 novembre 2003StatutMembreDernière intervention 6 décembre 2005
-
21 déc. 2004 à 10:05
SamDotNet
Messages postés11Date d'inscriptionlundi 24 février 2003StatutMembreDernière intervention15 avril 2006
-
11 janv. 2005 à 00:46
Bonjour,
Actuellement, dans mon prog j'ai deux boutons :
- un qui ouvre une boite de dialogue permettant de sélectionner un fichier (CommonDialog)
- un qui ouvre une autre boite de dialogue permettant de sélectionner un répertoire (API).
L'idée serait de trouver une boîte de dialogue qui permette de sélectionner soit un répertoire soit un fichier.
Si quelqu'un sait comment faire, merci d'avance !
A voir également:
Vba boite de dialogue pour sélectionner un dossier
zifnig
Messages postés69Date d'inscriptionvendredi 10 septembre 2004StatutMembreDernière intervention 4 mars 2013 21 déc. 2004 à 13:29
Salut,
J'aurais une option pour toi :
Tu crée une form avec une FileListBox et une DirListBox et avec en plus 2 optionButtons exclusifs où tu indique si tu choisis le répertoire ou le fichier.
Ensuite dans ton prog, en fonction de l'optionbutton tu fait transiter dans ta variable FileListBox1.FileName (nom du fichier) ou DirListBox1.name (nom du répertoire)
plaineR
Messages postés237Date d'inscriptionmercredi 26 novembre 2003StatutMembreDernière intervention 6 décembre 20054 22 déc. 2004 à 09:43
Je te remercie pour ta réponse, mais c'est justement ce que je voulais éviter (cela revient un peu à ce que je fais actuellement). J'aurais souhaiter obtenir une boite de dialogue qui permettait de sélectionner fichiers et répertoires, comme celle qui est dans WINRAR par exemple.
SamDotNet
Messages postés11Date d'inscriptionlundi 24 février 2003StatutMembreDernière intervention15 avril 2006 11 janv. 2005 à 00:46
Utilise cette fonction; Je l'ai découverte il ya trois jours
Private Declare Function SHBrowseForFolder Lib "shell32" (lpbi As BrowseInfo) As Long
Private Declare Function SHGetPathFromIDList Lib "shell32" (ByVal pidList As Long, ByVal lpBuffer As String) As Long
Function DirDlg(TheOwner As Long) As String
Dim iNull As Integer, lpIDList As Long, lResult As Long
Dim sPath As String, udtBI As BrowseInfo
With udtBI
'on définit ici le parent
.hWndOwner = TheOwner
'lstrcat appends the two strings and returns the memory address
.lpszTitle = lstrcat("C:", "")
'Return only if the user selected a directory
.ulFlags = BIF_RETURNONLYFSDIRS
End With
'Show the 'Browse for folder' dialog
lpIDList = SHBrowseForFolder(udtBI)
If lpIDList Then
sPath = String$(MAX_PATH, 0)
'Get the path from the IDList
SHGetPathFromIDList lpIDList, sPath
'free the block of memory
CoTaskMemFree lpIDList
iNull = InStr(sPath, vbNullChar)
If iNull Then
sPath = Left$(sPath, iNull - 1)
End If
End If
DirDlg = sPath
End Function
Pas le temps de traduire les commentaires
__________________________________________________________
Je persiste à croire qu'il n'y a rien dans la technologie....