Hi!
I decided to add this since there is little documentation for it. The older
version of a FileOpenDialog.
Bruce
Below is a function to use the common file dialog and searches for just sound
files, .wav, .ogg, and .mp3 files.
Format and filter format which uses the , as it's sperator from the description
and it's filter.
Note: This format uses the comma, or (,) to split up each descripption/filter
pair and the next filter as well.
Also note: If you want several filters as one, place a semicolon, (;) between
them.
Note: Newer formats on the open file replace the (,) with (|).
Function GetPath( ByVal dObj, ByVal FileName)
' Search for file path. The default path is the client default folder.
'string = obj.CommonFileDialog( Use4Open, DialogTitle, InitialName,
InitialDir, Filters, FilterIndex, DefaultExtension, Flags, ParentWindow)
'Use4Open = Determines whether the dialog will be used for opening (true) or
saving (false).
'Flags:
'cfdfAllowMultiSelect = Allows multiple files to be selected
'cfdfCreatePrompt = Prompts to create a non-existing file
'cfdfDoNotAddToRecent =
'Prevents the system from adding a link to the selected file in the directory
that contains the user's most recently used documents
'cfdfEnableDialogResizing = Allows the dialog to be resized
'cfdfUseExplorerStyleInterface = Use Explorer style interface
'cfdfFileMustExist = Specifies the file must exist before opening
'cfdfForceShowHidden = Show hidden files
'cfdfHideReadOnlyCheck = Hide "open as read only" check box
'cfdfUseLongFileNames = Use long file names
'cfdfNoChangeDirectory = Do not change the current working directory
'cfdfDoNotDereferenceLinks = Do not dereference links
'cfdfNoLongFileNames = Do not use long file names
'cfdfNoNetworkButton = Do not show a network button
'cfdfDoNotAllowReadOnlyFiles = Do not allow read only files
'cfdfWarnIfFileExists = Warn if a file exists when saving
'cfdfPathMustExist = Path must exist before saving
'cfdfNoPlacesBar = Do not show the places bar
'The following code shows an example of a filter that enables the user to
select
'Text files or graphic files that include bitmaps and icons:
'Example: Text (*.txt),*.txt, Pictures (*.bmp;*.ico), *.bmp;*.ico
'When you specify more than one filter for a dialog box, use the FilterIndex
' property to determine which filter is displayed as the default.
'string = obj.CommonFileDialog( Use4Open, DialogTitle, InitialName,
InitialDir, Filters, FilterIndex, DefaultExtension, Flags, ParentWindow)
'Use4Open = Determines whether the dialog will be used for opening (true) or
saving (false).
Dim fil, fil3, ext
fil = "": fil3 = "Wav,*.wav, Ogg,*.ogg, MP3,*.mp3, All Files( Wav; Ogg; and
MP3),*wav;*ogg;*mp3"
ext = InStrRev( FileName, ".", Len( FileName)-1)
If ext > 0 Then fil = Mid( FileName, ext)
If InStr( ".wav.ogg.mp3", LCase( fil )) Mod 4 > 0 Then fil = ""
GetPath = CommonFileDialog(True, "Search For Path", FileName, myFilePath,
fil3, 4, fil, cfdfPathMustExist + cfdfFileMustExist + cfdfUseLongFileNames +
cfdfDoNotDereferenceLinks + cfdfUseExplorerStyleInterface, dObj)
End Function
---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.window-eyes.com/private.cgi/scripting-window-eyes.com/attachments/20150822/b9a801aa/attachment.htm>
_______________________________________________
Any views or opinions presented in this email are solely those of the author
and do not necessarily represent those of Ai Squared.
For membership options, visit
http://lists.window-eyes.com/options.cgi/scripting-window-eyes.com/archive%40mail-archive.com.
For subscription options, visit
http://lists.window-eyes.com/listinfo.cgi/scripting-window-eyes.com
List archives can be found at
http://lists.window-eyes.com/private.cgi/scripting-window-eyes.com