Newsgroup: it.comp.lang.visual-basic
Titolo: [?] Selezione di una directory

Ciao a tutti e grazie per l'attenzione.
Se siete ancora qui avrei un problema da sottoporre, forse banale ma non
per me (sono autodidatta e agli inizi):
Ho bisogno di far selezionare una directory per ricavarne il path, ma se
utilizzo DriveListBox+DirListBox non riesco a selezionare directory
condivise su altre macchine (almeno credo, sto facendo il prg a casa su
un pc solo soletto con win98 per un ufficio con una rete WinNT).
Altrimenti usando CommonDialog posso selezionare unicamente dei file.
C'e' qualche modo per selezionare una directory su percorsi di rete
dunque?
Ciao e ri-grazie 
-- 
*********__**********__*************************************************
*       / /_  ______/ /___  _____ *           Andrea   Ortale          *
*  __  / / / / / __  / __ `/ ___/ *                                    *
* / /_/ / /_/ / /_/ / /_/ (__  )  *    
Ortale...@educ.di.unito.it
  *
**\____/\__,_/\__,_/\__,_/____/*****************************************

io ho trovato una scappatoia (bruttissima)...mappi un disco di rete
--
------------------------
Jollyno - icq#35189805
http://come.to/Jollyno
------------------------

 selezionare una cartella, una directory?
prova un po':
'frm
(dim imgpath as string, oldimgpath as string)
Private Sub cmdSetup_Click()
On Error GoTo errman
OldImgPath = ImgPath
Dim tmp
tmp = BrowseForFolder(Me.hwnd, _
"Current folder: " & OldImgPath & "." & vbCrLf & _
"The folder should contain...." & vbCrLf & _
"Clic Cancel to keep the current folder.")
If tmp <> "" And Right(tmp, 1) <> "\" Then tmp = tmp & "\"
ImgPath = IIf(tmp <> "", tmp, OldImgPath)
RefreshAll
If Not ImgTrue Then
MsgBox ("Folder does not contain any bitmaps! Run setup again!")
ImgPath = GetWinDir()
Exit Sub
Else
File1.SetFocus
File1.ListIndex = 0
End If
Exit Sub
errman:
MsgBox Error
ImgPath = GetWinDir()
End Sub
Private Function BrowseForFolder(hWndOwner As Long, sPrompt As String) As
String
Dim iNull As Integer
Dim lpIDList As Long, lResult As Long
Dim sPath As String
Dim udtBI As BrowseInfo
udtBI.hWndOwner = hWndOwner
udtBI.lpszTitle = lstrcat(sPrompt, "")
udtBI.ulFlags = BIF_RETURNONLYFSDIRS
lpIDList = SHBrowseForFolder(udtBI)
If lpIDList Then
sPath = String$(MAX_PATH, 0)
lResult = SHGetPathFromIDList(lpIDList, sPath)
Call CoTaskMemFree(lpIDList)
iNull = InStr(sPath, vbNullChar)
If iNull Then sPath = Left$(sPath, iNull - 1)
End If
BrowseForFolder = sPath
End Function
Private Function GetWinDir() As String
Dim Temp As String * 256
Dim x As Integer
x = GetWindowsDirectory(Temp, Len(Temp))
GetWinDir = Left$(Temp, x)
GetWinDir = IIf(Right(GetWinDir, 1) = "\", GetWinDir, GetWinDir & "\")
End Function
'bas
Public Type BrowseInfo
hWndOwner As Long
pIDLRoot As Long
pszDisplayName As Long
lpszTitle As Long
ulFlags As Long
lpfnCallback As Long
lParam As Long
iImage As Long
End Type
Public Const BIF_RETURNONLYFSDIRS = 1
Public Const MAX_PATH = 260
Declare Sub CoTaskMemFree Lib "ole32.dll" _
(ByVal hMem As Long)
Declare Function lstrcat Lib "kernel32" Alias "lstrcatA" _
(ByVal lpString1 As String, ByVal lpString2 As String) As Long
Declare Function SHBrowseForFolder Lib "shell32" _
(lpbi As BrowseInfo) As Long
Declare Function SHGetPathFromIDList Lib "shell32" _
(ByVal pidList As Long, ByVal lpBuffer As String) As Long
Declare Function GetWindowsDirectory Lib "kernel32" Alias
"GetWindowsDirectoryA" _
(ByVal lpBuffer As String, ByVal nSize As Long) As Long