calitoli
Messages postés45Date d'inscriptionjeudi 26 juin 2008StatutMembreDernière intervention 7 septembre 2012
-
23 juil. 2008 à 11:24
calitoli
Messages postés45Date d'inscriptionjeudi 26 juin 2008StatutMembreDernière intervention 7 septembre 2012
-
23 juil. 2008 à 11:44
Bonjour à tous,
J'ai utilisé le code ci-dessous pour selectionner un repertoir. Et comme erreur obtenu lorsque je lance mon application: "Can't find project or library" en selectionnant la variables "Space$".
Aidez-moi SVP.
Merci
code: 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 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
Function GetFolderName(Msg As String) As String
' Retourne le nom du repertoire selectionner
Dim bInfo As BROWSEINFO, path As String, r As Long, x As Long, pos As Integer
bInfo.pidlRoot = 0&
If IsMissing(Msg) Then
bInfo.lpszTitle = "Selectionner un répertoire de travail" ' the dialog title
Else
bInfo.lpszTitle = Msg
End If
bInfo.ulFlags = &H1
'Ouvre le dialog
x = SHBrowseForFolder(bInfo)
path = Space$(512)
r = SHGetPathFromIDList(ByVal x, ByVal path)
If r Then
pos = InStr(path, Chr$(0))
GetFolderName = Left(path, pos - 1)
Else
GetFolderName = ""
End If
End Function
'===========================