Private Const BIF_USENEWUI = &H40
Private Declare Function SHBrowseForFolder Lib "shell32.dll" Alias "SHBrowseForFolderA" (lpBrowseInfo As BROWSEINFO) As Long
Private Declare Function SHGetPathFromIDList Lib "shell32.dll" Alias "SHGetPathFromIDListA" (ByVal pidl As Long, ByVal pszPath As String) As Long
Private Declare Sub CoTaskMemFree Lib "ole32.dll" (ByVal pv As Long)
Public Function SfogliaCartelle(ByVal Handle As Long) As String
Dim BInfo As BROWSEINFO
Dim CartellaScelta As Long
Dim PercorsoAllocato As Long
Dim PercorsoScelto As String
BInfo.hOwner = Handle
BInfo.lpszTitle = "Scegli una cartella:"
BInfo.ulFlags = BIF_USENEWUI
PercorsoAllocato = SHBrowseForFolder(BInfo)
PercorsoScelto = Space$(512)
CartellaScelta = SHGetPathFromIDList(PercorsoAllocato, PercorsoScelto)
If CartellaScelta Then
SfogliaCartelle = Left$(PercorsoScelto, InStr(PercorsoScelto, Chr$(0)) - 1)
CoTaskMemFree PercorsoAllocato
Else
SfogliaCartelle = ""
End If
End Function
et voilà
bastava modificare lo stile.
Ultima modifica effettuata da P4p3r0g4 il 01/06/2007 alle 11:14 |