Function FileOpenDialog, FileSaveDialog

 

Function FileOpenDialog( ByRef sInitDir$, ByRef sFilter$, ByVal nOption& ) As String

 

Function FileSaveDialog( ByRef sInitDir$, ByRef sFilter$, ByRef sDefaultExt$, ByVal nOption& ) As String

Purpose: Invoke standard windows dialog box for open and save file

Works in:      OneLiner and Power Flow.

Parameters:     

sInitDir      [in] Initial directory selected in the GUI file tree

sFilter       [in] File type single filter or multiple filter group (see remarks)

sDefaultExt [in] Default file extension

nOption       [in] Dialog options. To use more than one option, add the required values together
1 = File must exist
2 = Path must exist
4 = Allow multiselect
16 = Prompt to overwrite file

Return value:      Full path name of the file(s) or blank string if user pressed cancel.

Remarks:

Single filter must be  in format Description|wildcard|| such as “All (*.*)|*.*||”

Wildcard patterns are separated by semicolon as in example

Multiple groups of filter are separated by pipe character |.

Results for multiple sections are “File1|File2|…”

Example:

 

sPath$ = FileOpenDialog( "", _

           "Change files (*.chf)|*.chf|OneLiner files (*.olr,*.dxt)|*.olr;*.dxt||", _

           4 )

Print sPath

sPath$ = FileSaveDialog( "", "", ".txt", 2+16 )

Print sPath

sPath$ = FolderSelectDialog( "My Dialog", "c:\" )

Print sPath