Access Abrir dialogo de búsqueda de fichero en modo vistas en miniatura.

Hola. Utilizo el siguiente código (disponible en varios foros) para abrir un dialogo y buscar un fichero (para obtener su path y asignarlo a una foto). El cuadro de dialogo se abre en vistas en miniaturas sólo si busco en el directorio Mis Imágenes, pero en los demás directorios se abre en modo lista. Si alguien conoce este código y sabe decirme como modificarlo (si se puede) para abrir el dialogo en vistas en miniaturas por defecto le estaría muy agradecido. Un saludo.
???El código:

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
Public Const OFN_READONLY = &H1
Public Const OFN_OVERWRITEPROMPT = &H2
Public Const OFN_HIDEREADONLY = &H4
Public Const OFN_NOCHANGEDIR = &H8
Public Const OFN_SHOWHELP = &H10
Public Const OFN_ENABLEHOOK = &H20
Public Const OFN_ENABLETEMPLATE = &H40
Public Const OFN_ENABLETEMPLATEHANDLE = &H80
Public Const OFN_NOVALIDATE = &H100
Public Const OFN_ALLOWMULTISELECT = &H200
Public Const OFN_EXTENSIONDIFFERENT = &H400
Public Const OFN_PATHMUSTEXIST = &H800
Public Const OFN_FILEMUSTEXIST = &H1000
Public Const OFN_CREATEPROMPT = &H2000
Public Const OFN_SHAREAWARE = &H4000
Public Const OFN_NOREADONLYRETURN = &H8000
Public Const OFN_NOTESTFILECREATE = &H10000
Public Const OFN_NONETWORKBUTTON = &H20000
Public Const OFN_NOLONGNAMES = &H40000
Public Const OFN_EXPLORER = &H80000
Public Const OFN_NODEREFERENCELINKS = &H100000
Public Const OFN_LONGNAMES = &H200000
Declare Function GetOpenFileName Lib "comdlg32.dll" Alias "GetOpenFileNameA" (pOPENFILENAME As OPENFILENAME) As Long
Declare Function GetSaveFileName Lib "comdlg32.dll" Alias "GetSaveFileNameA" (pOPENFILENAME As OPENFILENAME) As Long
Declare Function GetFileTitle Lib "comdlg32.dll" Alias "GetFileTitleA" (ByVal lpszFile As String, ByVal lpszTitle As String, ByVal cbBuf As Integer) As Integer
Public Const OFN_SHAREFALLTHROUGH = 2
Public Const OFN_SHARENOWARN = 1
Public Const OFN_SHAREWARN = 0
'FOLDER
Private Type BROWSEINFO
hOwner As Long
pidlRoot As Long
pszDisplayName As String
lpszTitle As String
ulFlags As Long
lpfn As Long
lParam As Long
iImage As Long
End Type
Private Declare Function SHGetPathFromIDList Lib "shell32.dll" Alias _
"SHGetPathFromIDListA" (ByVal pidl As Long, _
ByVal pszPath As String) As Long
Private Declare Function SHBrowseForFolder Lib "shell32.dll" Alias _
"SHBrowseForFolderA" (lpBrowseInfo As BROWSEINFO) _
As Long
Private Const BIF_RETURNONLYFSDIRS = &H1
Function DialogoComun(ObjForm As Form, FiltroArch As String, TipoArch As String, DirectIni As String) As String
Dim file As OPENFILENAME, sFile As String, sFileTitle As String, lResult As Long, iDelim As Integer
file.lStructSize = Len(file)
file.hwndOwner = ObjForm.hwnd
file.flags = OFN_HIDEREADONLY + OFN_PATHMUSTEXIST + OFN_FILEMUSTEXIST
file.lpstrFile = FiltroArch & String$(250, 0)
file.nMaxFile = 255
file.lpstrFileTitle = String$(255, 0)
file.nMaxFileTitle = 255
'Path Inicial
file.lpstrInitialDir = ObjForm.RutaInicial 'Environ$(DirectIni)
'Filtro
file.lpstrFilter = TipoArch & Chr$(0)
file.nFilterIndex = 1
'Título del diálogo
file.lpstrTitle = ObjForm.Título
lResult = GetOpenFileName(file)
If lResult <> 0 Then
iDelim = InStr(file.lpstrFile, Chr$(0))
If iDelim > 0 Then
sFile = Left$(file.lpstrFile, iDelim - 1)
End If
DialogoComun = sFile
End If
End Function

Añade tu respuesta

Haz clic para o