Nochmal ich...
ich habe das mal ausprobiert und es funktioniert so wie ich gesagt hatte..
Den Code unten ins Modul und der Aufruf ist dann
ShowOpen Me.hwnd
Viel Spaß damit
Option Explicit
Private Declare Function GetOpenFileName Lib "comdlg32.dll" Alias _
"GetOpenFileNameA" (pOFN As OPENFILENAME) As Long
Private Const WM_INITDIALOG = &H110
Private Const WM_UPDATEUISTATE = &H128
Const OFN_ENABLEHOOK = &H20
Const OFN_EXPLORER = &H80000
Const StyleDetails = &H702C
Private Type OPENFILENAME
lStructSize As Long
hwndOwner As Long
hInstance As Long
lpstrFilter As String
lpstrCustomFilter As String
nMaxCustFilter As Long
nFilterIndex As Long
lpstrFile As String
nMaxFile As Long
lpstrFileTitle As String
nMaxFileTitle As Long
lpstrInitialDir As String
lpstrTitle As String
flags As Long
nFileOffset As Integer
nFileExtension As Integer
lpstrDefExt As String
lCustData As Long
lpfnHook As Long
lpTemplateName As String
End Type
Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" ( _
ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) _
As Long
Private Declare Function GetClassName Lib "user32.dll" Alias "GetClassNameA" ( _
ByVal hwnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As _
Long
Private Declare Function EnumChildWindows Lib "user32.dll" (ByVal hWndParent As _
Long, ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
Private Declare Function GetParent Lib "user32.dll" (ByVal hwnd As Long) As Long
Private Const WM_COMMAND As Long = &H111
Public Function ShowOpen(ByVal hwndOwner As Long) As String
Dim result As Long
Dim sBuffer As String
Dim CommonOFN As OPENFILENAME
sBuffer = String(255, 0)
With CommonOFN
.lStructSize = Len(CommonOFN)
.flags = OFN_EXPLORER + OFN_ENABLEHOOK
.hInstance = App.hInstance
.hwndOwner = hwndOwner
.lpstrFile = sBuffer
.lpfnHook = GetAddress(AddressOf DialogCallback)
.nFilterIndex = 1
.nMaxFile = Len(sBuffer)
result = GetOpenFileName(CommonOFN)
If result <> 0 Then
ShowOpen = Left(.lpstrFile, InStr(.lpstrFile, vbNullChar) - 1)
End If
End With
End Function
Private Function GetAddress(ByVal Addr As Long) As Long
GetAddress = Addr
End Function
Public Function DialogCallback(ByVal hWndDlg As Long, ByVal Msg As Long, _
ByVal wParam As Long, ByVal lParam As Long) As Long
If Msg = WM_UPDATEUISTATE Then
SetDetailView hWndDlg
End If
End Function
Public Sub SetDetailView(ByVal DHWND As Long)
Dim hwnd As Long
hwnd = GetParent(DHWND)
Call EnumSelected(hwnd)
End Sub
Private Sub EnumSelected(hwnd As Long)
Call EnumChildWindows(hwnd, AddressOf EnumChildProc, &H0)
End Sub
Public Function EnumChildProc(ByVal hwnd As Long, _
ByVal lParam As Long) As Long
Dim lCont As Long
Dim lRet As Long
Dim sBuffer As String
lCont = 1
sBuffer = Space$(260)
lRet = GetClassName(hwnd, sBuffer, Len(sBuffer))
If InStr(1, sBuffer, "SHELLDLL_DefView") > 0 Then
Call SendMessage(hwnd, WM_COMMAND, StyleDetails, ByVal 0&)
lCont = 0
End If
EnumChildProc = lCont
End Function Gru?
Ralf
|