Re: Drucken in Datei
05.12.2002 10:49:37
Nepumuk
Hallo Matthias,
dieser Code öffnet ein kleines Explorerfenster und liefert den gewählten Pfad zurück.Option Explicit
Private Declare Function SHBrowseForFolder Lib "shell32" (lpbi As InfoT) As Long
Private Declare Function CoTaskMemFree Lib "ole32" (ByVal hMem As Long) As Long
Private Declare Function lstrcat Lib "kernel32" Alias "lstrcatA" (ByVal lpStr1 As String, ByVal lpStr2 As String) As Long
Private Declare Function SHGetPathFromIDList Lib "shell32" (ByVal pList As Long, ByVal lpBuffer As String) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassname As String, ByVal lpWindowName As String) As Long
Private Type InfoT
hwnd As Long
Root As Long
DisplayName As Long
Title As Long
Flags As Long
FName As Long
lParam As Long
Image As Long
End Type
Private Function GetAOrdner() As String
Dim xl As InfoT, IDList As Long, RVal As Long, PrgName As String
With xl
.hwnd = FindWindow("", "Auswahl")
.Title = lstrcat("Bitte wählen Sie ein Verzeichnis", "")
.Flags = 1
End With
IDList = SHBrowseForFolder(xl)
If IDList <> 0 Then
PrgName = Space(256)
RVal = SHGetPathFromIDList(IDList, PrgName)
CoTaskMemFree (IDList)
PrgName = LTrim(RTrim(PrgName))
End If
GetAOrdner = Left(PrgName, Len(PrgName) - 1) & "\"
End Function
Gruß
Nepumuk