|
| Commondialog: Hvordan kan man vælge en Fol~ Fra : bnj |
Dato : 14-01-02 09:22 |
|
Findes der en indstilling af "commondialog" så man kan få den til at vælge
en "folder".
Hvis ikke, findes der da en anden type standard dialogboks i API'et som kan
benyttes?
Jeg vil meget nødigt selv designe en, da programmet så om nogle windows
generationer vil have et totalt non standard vindue.. (som man ser det i de
fleste Java programmer )..
/ Bo
| |
Carsten Suurland (14-01-2002)
| Kommentar Fra : Carsten Suurland |
Dato : 14-01-02 09:53 |
|
Hej Bo
Du skal bruge API'et SHBrowseForFolder
/Carsten Suurland
| |
bnj (14-01-2002)
| Kommentar Fra : bnj |
Dato : 14-01-02 10:09 |
|
Tak for det. Carsten
Det vil jeg straks prøve. Jeg fadt en "declare" i MSDN hvis andre skulle
være interesseret:
/ Bo
Private Const BIF_RETURNONLYFSDIRS = 1
Private Const BIF_DONTGOBELOWDOMAIN = 2
Private Const MAX_PATH = 260
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 Declare Function lstrcat Lib "kernel32" Alias "lstrcatA" _
(ByVal lpString1 As String, ByVal _
lpString2 As String) As Long
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
Private Sub Command1_Click()
'Opens a Treeview control that displays the directories in a computer
Dim lpIDList As Long
Dim sBuffer As String
Dim szTitle As String
Dim tBrowseInfo As BrowseInfo
szTitle = "This is the title"
With tBrowseInfo
.hWndOwner = Me.hWnd
.lpszTitle = lstrcat(szTitle, "")
.ulFlags = BIF_RETURNONLYFSDIRS + BIF_DONTGOBELOWDOMAIN
End With
lpIDList = SHBrowseForFolder(tBrowseInfo)
If (lpIDList) Then
sBuffer = Space(MAX_PATH)
SHGetPathFromIDList lpIDList, sBuffer
sBuffer = Left(sBuffer, InStr(sBuffer, vbNullChar) - 1)
MsgBox sBuffer
End If
End Sub
"Carsten Suurland" <carsten@suurland.dk> wrote in message
news:H0x08.14291$aS.1960482@news010.worldonline.dk...
> Hej Bo
>
> Du skal bruge API'et SHBrowseForFolder
>
> /Carsten Suurland
>
>
| |
|
|