PDA

View Full Version : [VB6] Aiuto please!!


A\|dR3\V
18-07-2003, 11:51
avrei bisogno di caricare quella finestra di windows dove ti premette di selezionare una cartella, o un file. so che si può ma non so come. potete aiutarmi?
tnx

matpez
18-07-2003, 13:22
Devi selezionare il componenete Microsoft Common Dialog

Dopo di che ci sono delle funzioncine tipo OPEN, SAVE, PRINT e altre...se paciocchi un pochino vedi che trovi tutto e di +!! :P

davidino80
18-07-2003, 13:25
heyla matpez... tu rispondi a qualsiasi tip!?!?? ehehhe grande

cmq concordo con la risposta! ;)

ciao :D

matpez
18-07-2003, 14:02
Originariamente inviato da davidino80
heyla matpez... tu rispondi a qualsiasi tip!?!?? ehehhe grande

cmq concordo con la risposta! ;)

ciao :D

Grassie
:rolleyes:

Michelle
18-07-2003, 21:10
Originariamente inviato da davidino80
heyla matpez... tu rispondi a qualsiasi tip!?!?? ehehhe grande

cmq concordo con la risposta! ;)

ciao :D

si ma così non permette di selezionare una directory

leon84
18-07-2003, 21:16
Si esatto non permette di selezionare le cartelle la Commondialog . Per le cartelle dovresti utilizzare il DirListBox .

matpez
19-07-2003, 03:26
Dovresti utilizzare la funzione API BrowseForFolder, quello ti apre solo le cartelle e con le dovute flag anche i file:


Private 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
Const BIF_RETURNONLYFSDIRS = 1
Const MAX_PATH = 260
Private Declare Sub CoTaskMemFree Lib "ole32.dll" (ByVal hMem As Long)
Private Declare Function lstrcat Lib "kernel32" Alias "lstrcatA" (ByVal lpString1 As String, ByVal lpString2 As String) As Long
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
Private Sub Form_Load()
'KPD-Team 1998
'URL: http://www.allapi.net/
'KPDTeam@Allapi.net
Dim iNull As Integer, lpIDList As Long, lResult As Long
Dim sPath As String, udtBI As BrowseInfo

With udtBI
'Set the owner window
.hWndOwner = Me.hWnd
'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

MsgBox sPath
End Sub

cionci
19-07-2003, 16:43
Mitici quelli di AllAPI... Peccato che non sviluppino più API-Guide :(

matpez
19-07-2003, 18:19
E si, è un vero peccato :(