473,606 Members | 2,381 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Changing The Default View Of An Opened Folder

I'm using the following code from the Access Web to open a folder. The
folder opens in "List" View. Is there an addition that I can make to
the code to force the folder to open in "Details" view?

'This code was originally written by Ken Getz.
'It is not to be altered or distributed,
'except as part of an application.
'You are free to use it in any application,
'provided the copyright notice is left unchanged.
'
' Code courtesy of:
' Microsoft Access 95 How-To
' Ken Getz and Paul Litwin
' Waite Group Press, 1996

Type tagOPENFILENAME
lStructSize As Long
hwndOwner As Long
hInstance As Long
strFilter As String
strCustomFilter As String
nMaxCustFilter As Long
nFilterIndex As Long
strFile As String
nMaxFile As Long
strFileTitle As String
nMaxFileTitle As Long
strInitialDir As String
strTitle As String
Flags As Long
nFileOffset As Integer
nFileExtension As Integer
strDefExt As String
lCustData As Long
lpfnHook As Long
lpTemplateName As String
End Type

Declare Function aht_apiGetOpenF ileName Lib "comdlg32.d ll" _
Alias "GetOpenFileNam eA" (OFN As tagOPENFILENAME ) As Boolean

Declare Function aht_apiGetSaveF ileName Lib "comdlg32.d ll" _
Alias "GetSaveFileNam eA" (OFN As tagOPENFILENAME ) As Boolean
Declare Function CommDlgExtended Error Lib "comdlg32.d ll" () As Long

Global Const ahtOFN_READONLY = &H1
Global Const ahtOFN_OVERWRIT EPROMPT = &H2
Global Const ahtOFN_HIDEREAD ONLY = &H4
Global Const ahtOFN_NOCHANGE DIR = &H8
Global Const ahtOFN_SHOWHELP = &H10
' You won't use these.
'Global Const ahtOFN_ENABLEHO OK = &H20
'Global Const ahtOFN_ENABLETE MPLATE = &H40
'Global Const ahtOFN_ENABLETE MPLATEHANDLE = &H80
Global Const ahtOFN_NOVALIDA TE = &H100
Global Const ahtOFN_ALLOWMUL TISELECT = &H200
Global Const ahtOFN_EXTENSIO NDIFFERENT = &H400
Global Const ahtOFN_PATHMUST EXIST = &H800
Global Const ahtOFN_FILEMUST EXIST = &H1000
Global Const ahtOFN_CREATEPR OMPT = &H2000
Global Const ahtOFN_SHAREAWA RE = &H4000
Global Const ahtOFN_NOREADON LYRETURN = &H8000
Global Const ahtOFN_NOTESTFI LECREATE = &H10000
Global Const ahtOFN_NONETWOR KBUTTON = &H20000
Global Const ahtOFN_NOLONGNA MES = &H40000
' New for Windows 95
Global Const ahtOFN_EXPLORER = &H80000
Global Const ahtOFN_NODEREFE RENCELINKS = &H100000
Global Const ahtOFN_LONGNAME S = &H200000

Function TestIt()
Dim strFilter As String
Dim lngFlags As Long
strFilter = ahtAddFilterIte m(strFilter, "Access Files (*.mda,
*.mdb)", _
"*.MDA;*.MD B")
strFilter = ahtAddFilterIte m(strFilter, "dBASE Files (*.dbf)",
"*.DBF")
strFilter = ahtAddFilterIte m(strFilter, "Text Files (*.txt)",
"*.TXT")
strFilter = ahtAddFilterIte m(strFilter, "All Files (*.*)", "*.*")
MsgBox "You selected: " & ahtCommonFileOp enSave(InitialD ir:="C:\",
_
Filter:=strFilt er, FilterIndex:=3, Flags:=lngFlags , _
DialogTitle:="H ello! Open Me!")
' Since you passed in a variable for lngFlags,
' the function places the output flags value in the variable.
Debug.Print Hex(lngFlags)
End Function

Function GetOpenFile(Opt ional varDirectory As Variant, _
Optional varTitleForDial og As Variant) As Variant
' Here's an example that gets an Access database name.
Dim strFilter As String
Dim lngFlags As Long
Dim varFileName As Variant
' Specify that the chosen file must already exist,
' don't change directories when you're done
' Also, don't bother displaying
' the read-only box. It'll only confuse people.
lngFlags = ahtOFN_FILEMUST EXIST Or _
ahtOFN_HIDEREAD ONLY Or ahtOFN_NOCHANGE DIR
If IsMissing(varDi rectory) Then
varDirectory = ""
End If
If IsMissing(varTi tleForDialog) Then
varTitleForDial og = ""
End If

' Define the filter string and allocate space in the "c"
' string Duplicate this line with changes as necessary for
' more file templates.
strFilter = ahtAddFilterIte m(strFilter, _
"Access (*.mdb)", "*.MDB;*.MD A")
' Now actually call to get the file name.
varFileName = ahtCommonFileOp enSave( _
OpenFile:=True, _
InitialDir:=var Directory, _
Filter:=strFilt er, _
Flags:=lngFlags , _
DialogTitle:=va rTitleForDialog )
If Not IsNull(varFileN ame) Then
varFileName = TrimNull(varFil eName)
End If
GetOpenFile = varFileName
End Function

Function ahtCommonFileOp enSave( _
Optional ByRef Flags As Variant, _
Optional ByVal InitialDir As Variant, _
Optional ByVal Filter As Variant, _
Optional ByVal FilterIndex As Variant, _
Optional ByVal DefaultExt As Variant, _
Optional ByVal FileName As Variant, _
Optional ByVal DialogTitle As Variant, _
Optional ByVal hwnd As Variant, _
Optional ByVal OpenFile As Variant) As Variant
' This is the entry point you'll use to call the common
' file open/save dialog. The parameters are listed
' below, and all are optional.
'
' In:
' Flags: one or more of the ahtOFN_* constants, OR'd together.
' InitialDir: the directory in which to first look
' Filter: a set of file filters, set up by calling
' AddFilterItem. See examples.
' FilterIndex: 1-based integer indicating which filter
' set to use, by default (1 if unspecified)
' DefaultExt: Extension to use if the user doesn't enter one.
' Only useful on file saves.
' FileName: Default value for the file name text box.
' DialogTitle: Title for the dialog.
' hWnd: parent window handle
' OpenFile: Boolean(True=Op en File/False=Save As)
' Out:
' Return Value: Either Null or the selected filename
Dim OFN As tagOPENFILENAME
Dim strFileName As String
Dim strFileTitle As String
Dim fResult As Boolean
' Give the dialog a caption title.
If IsMissing(Initi alDir) Then InitialDir = CurDir
If IsMissing(Filte r) Then Filter = ""
If IsMissing(Filte rIndex) Then FilterIndex = 1
If IsMissing(Flags ) Then Flags = 0&
If IsMissing(Defau ltExt) Then DefaultExt = ""
If IsMissing(FileN ame) Then FileName = ""
If IsMissing(Dialo gTitle) Then DialogTitle = ""
If IsMissing(hwnd) Then hwnd = Application.hWn dAccessApp
If IsMissing(OpenF ile) Then OpenFile = True
' Allocate string space for the returned strings.
strFileName = Left(FileName & String(256, 0), 256)
strFileTitle = String(256, 0)
' Set up the data structure before you call the function
With OFN
..lStructSize = Len(OFN)
..hwndOwner = hwnd
..strFilter = Filter
..nFilterIndex = FilterIndex
..strFile = strFileName
..nMaxFile = Len(strFileName )
..strFileTitle = strFileTitle
..nMaxFileTitle = Len(strFileTitl e)
..strTitle = DialogTitle
..Flags = Flags
..strDefExt = DefaultExt
..strInitialDir = InitialDir
' Didn't think most people would want to deal with
' these options.
..hInstance = 0
'.strCustomFilt er = ""
'.nMaxCustFilte r = 0
..lpfnHook = 0
'New for NT 4.0
..strCustomFilt er = String(255, 0)
..nMaxCustFilte r = 255
End With
' This will pass the desired data structure to the
' Windows API, which will in turn it uses to display
' the Open/Save As Dialog.
If OpenFile Then
fResult = aht_apiGetOpenF ileName(OFN)
Else
fResult = aht_apiGetSaveF ileName(OFN)
End If

' The function call filled in the strFileTitle member
' of the structure. You'll have to write special code
' to retrieve that if you're interested.
If fResult Then
' You might care to check the Flags member of the
' structure to get information about the chosen file.
' In this example, if you bothered to pass in a
' value for Flags, we'll fill it in with the outgoing
' Flags value.
If Not IsMissing(Flags ) Then Flags = OFN.Flags
ahtCommonFileOp enSave = TrimNull(OFN.st rFile)
Else
ahtCommonFileOp enSave = vbNullString
End If
End Function

Function ahtAddFilterIte m(strFilter As String, _
strDescription As String, Optional varItem As Variant) As String
' Tack a new chunk onto the file filter.
' That is, take the old value, stick onto it the description,
' (like "Databases" ), a null character, the skeleton
' (like "*.mdb;*.md a") and a final null character.

If IsMissing(varIt em) Then varItem = "*.*"
ahtAddFilterIte m = strFilter & _
strDescription & vbNullChar & _
varItem & vbNullChar
End Function

Private Function TrimNull(ByVal strItem As String) As String
Dim intPos As Integer
intPos = InStr(strItem, vbNullChar)
If intPos > 0 Then
TrimNull = Left(strItem, intPos - 1)
Else
TrimNull = strItem
End If
End Function

Nov 13 '05 #1
1 2605
Wayne wrote:
I'm using the following code from the Access Web to open a folder. The folder opens in "List" View. Is there an addition that I can make to
the code to force the folder to open in "Details" view?


The OPENFILENAME structure you show has something called Flags. If the
OFN_EXPLORER flag is part of Flags it may be possible to get a dialog
box with Explorer features perhaps modifiable by the lpTemplateName you
also show. This is all hypothesis, and I don't recall why I know it
given that the Win32 help file agreement doesn't allow anyone to quote
from it without written permission from Microsoft.

James A. Fortune

Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1969
by: John Caruthers | last post by:
HELP! This problem is driving me crazy. All other web sites that are being served out through this server are working, including sites and virtual directories that are under the Default Web Site, yet when I attempt to browse the Default Web Site I get this error: The page cannot be displayed
5
2462
by: David Deacon | last post by:
Hi i was given the following advise,below my OriginalQuestion I am a little new to ADOX can you direct me to the following Do i place the code behind a button on a form? Or do i place it in the On Open event and have a the default 10% and give the user the option to change it to 0% I have referenced th appropriate library and the default value of the field to change is 0.1
1
2784
by: gan | last post by:
I created a ASP.NET web setup project with the project name "Setup". I noticed that this name will be used as the default Virtual Directory name during deployment. I'd like to know whether we can change this default value while preserving the project name? Thanks in advance
1
1870
by: js | last post by:
Does anyone know how to create a web project with Visual Studio.Net 2003 on IIS6 running on Windows Server 2003? The IIS has the default website disabled, and a new website is created. I have been developing ASP applications on this new website by editing individual file in Visual Studio, because I could not get VS to create a project with default website disabled. I chose this approach so I don't have to use virtual directory under the...
0
1235
by: beartrax | last post by:
I am using Windows Mobile 2003 SE and trying to change the menu selectable VIEW mode by using javascript or any other programming method within an html page. The menu view modes I would like to be able to change with a page's html code are (VIEW, LAYOUT, DEFAULT) and (VIEW, LAYOUT, DISPLAY) I have one page that displays a large scrollable image (satellite map image) with associated image map and would like to change to PPC IE default...
1
8903
by: sunil | last post by:
Hi, I want to change the default installation folder to my own path. I did it by changing the application folder's DefaultLocation property. The installation works fine as long the path that I give is complete path. If I give relative path, there is an error. The path is relative to the location of my solution folder. Just to be more clear, I have several projects in my solution. The setup project contains one executable as the primary...
8
4687
by: Arno R | last post by:
Hi all. When I need to search for pictures, I always have too choose thumbnail-view manually. Is it possible to open the common dialog in thumbnail-view programmatically? Example ?? At the moment I am using Ken Getz' code. at http://www.mvps.org/access/api/api0001.htm Thanks Arno R
6
7040
by: Neil | last post by:
I had a strange situation with a view in SQL 7, that I could use some input on. I had a very simple view -- select a, b, c from table1 where x=y and z=q. Field a in table1 originally was varchar 70. A long time ago I changed it to varchar 95. I used this view as an ODBC linked table in an Access MDB. Recently, there was one row which has a value in field a that was more than 70 characters long. This caused an error when the view as...
10
9658
by: =?Utf-8?B?SmFtZXMgV29uZw==?= | last post by:
Hi everybody, I'm trying to use the new VB 2008 right now and I want to know how to preset the company name and copyright informtion in Assembly Information. In my current VB 2005, company name and copyright information (the word "CopyRight" with company name and year) is filled in automatically once a new project is created. However, I have no idea where I can configurate it in my new VB 2008. Thanks for your kindly advice!
0
8440
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8431
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8096
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
5966
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5466
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3937
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3980
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2448
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1300
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.