FileOpenSaveDialog Interface Reference

This object represents an file open dialog box or an file save dialog box. More...

Inheritance diagram for FileOpenSaveDialog:

Inheritance graph
Collaboration diagram for FileOpenSaveDialog:

Collaboration graph
List of all members.

Public Member Functions

 Execute ([out, retval] VARIANT_BOOL *pResult)
 Shows the dialog.
 AddPlace ([in] BSTR Value,[in, defaultvalue("")] BSTR Name,[in, defaultvalue(0)] LONG Placement)
 Adds a folder to the list of places.

Properties

BSTR RW DefaultExt []
 Gets or sets the default extension.
BSTR RW Filter []
 Gets or sets the filter.
BSTR RW FileName []
 Gets or sets the selected file name.
ULONG RW Flags []
 See the "Flags" argument of the OpenDialog method.
BSTR RW Text []
 Gets or sets the title of the dialog.
ULONG RW FilterIndex []
 Gets or sets the selected index of the filter selection combobox.
BSTR RW Directory []
 Gets or sets the current directory for the dialog.
VARIANT_BOOL RW OverwritePrompt []
 Causes the Save As dialog box to generate a message box if the selected file already exists.
VARIANT_BOOL RW AllowMultiselect []
 Specifies that the Dialog allows multiple selections.
VARIANT_BOOL RW PathMustExist []
 Specifies that the user can type only valid paths and file names.
VARIANT_BOOL RW FileMustExist []
 Specifies that the user can type only names of existing files.
VARIANT_BOOL RW CreatePrompt []
 Prompt for creation if the item returned in the save dialog does not exist.
VARIANT_BOOL RW NoReadOnlyReturn []
 Do not return read-only items.
VARIANT_BOOL RW NoTestFileCreate []
 Do not test creation of the item returned in the save dialog.
VARIANT_BOOL RW NoDereferenceLinks []
 Shortcuts should not be treated as their target items, allowing an application to open a .lnk file.
VARIANT_BOOL RW DontAddToRecent []
 Do not save the item being opened or saved to the list of recent places.
VARIANT_BOOL RW ForceShowHidden []
 Always show hidden items.
VARIANT_BOOL RW NoPlacesBar []
 If "TRUE", the places bar is not displayed.
VARIANT_BOOL RW ForceFileSystem []
 Ensures that returned items are file system items (SFGAO_FILESYSTEM).
VARIANT_BOOL RW AllNonStorageItems []
 Enables the user to choose any item in the shell namespace, not just those with SFGAO_STREAM or SFAGO_FILESYSTEM attributes.
VARIANT_BOOL RW HideMRUPlaces []
 Hide the list of places from which the user has recently opened or saved items.
VARIANT_BOOL RW HidePinnedPlaces []
 Hide the list of pinned places from which the user can choose.
VARIANT_BOOL RW DefaultNoMiniMode []
 Indicates to the Save As dialog box that it should open in expanded mode.
VARIANT_BOOL RW ForcePreviewPaneOn []
 Indicates to the Open dialog box that the preview pane should always be displayed.
IDispatch *R FileNames []
 Return a Collection that contains list of the selected file names.
BSTR RW ClientGuid []
 Associates a GUID with a dialog's persisted state.
VARIANT W OnCloseQuery []
 Sets the event handler for the OnCloseQuery event.
VARIANT W OnChange []
 Sets the event handler for the OnChange event.
VARIANT W OnFolderChange []
 Sets the event handler for the OnFolderChange event.
VARIANT W OnTypeChange []
 Sets the event handler for the OnTypeChange event.
VARIANT W OnHelp []
 Sets the event handler for the OnHelp event.

Detailed Description

This object represents an file open dialog box or an file save dialog box.

See also:
CreateOpenDialog.

CreateSaveDialog.

FileOpenSaveDialogEvents.

WindowSystemObject::EnableVistaFileDialog.

Example (JScript):

o = new ActiveXObject("Scripting.WindowSystemObject")

f = o.CreateForm(0,0,0,0)

f.ClientWidth = 500
f.ClientHeight = 300
f.CenterControl()
f.Text = "Text Editor"

edit = f.CreateEdit(0,0,0,0)
edit.Align = o.Translate("AL_CLIENT")
edit.HideSelection = false
edit.MultiLine = true
edit.ScrollBars = o.Translate("SS_BOTH")

fileMenu = f.Menu.Add("File")
fileMenu.Add("Open","CTRL+O").OnExecute = FileOpen

fileMenu.NewLine()
fileMenu.Add("Exit","ESC").OnExecute = CloseFormHandler

function FileOpen(sender)
{
        var Dialog = f.CreateOpenDialog()
        Dialog.Filter = "Text Files (*.txt)|*.txt"
        Dialog.Text = "Select a text file"
        if (Dialog.Execute())
        {
                var fileName = Dialog.FileName
                var fs = new ActiveXObject("Scripting.FileSystemObject")
                var file = fs.OpenTextFile(fileName,1,false)
                edit.Clear()
                edit.Text = file.ReadAll()
        }
}

f.Show()

o.Run()

function CloseFormHandler(sender)
{
        sender.Form.Close()
}



Windows Vista file dialog:

FileOpen2.jpg

Windows 2000/XP file dialog:

FileOpen.jpg

Note:
If WindowSystemObject::EnableVistaFileDialog = FALSE then GetOpenFileName/GetSaveFileName (see MSDN) function will be used. If WindowSystemObject::EnableVistaFileDialog = TRUE then the IFileOpenDialog/IFileSaveDialog will be used in Windows Vista and later, and GetOpenFileName/GetSaveFileName in the previous Windows versions.


Member Function Documentation

AddPlace ( [in] BSTR  Value,
[in, defaultvalue("")] BSTR  Name,
[in, defaultvalue(0)] LONG  Placement 
)

Adds a folder to the list of places.

Parameters:
Value The folder.
Name Name.
Placement The placement, can be a one of the following values:
  • 0 Bottom,
  • 1 Top.
Only for new Vista file dialogs.

Since:
1.1.16.

Execute ( [out, retval] VARIANT_BOOL *  pResult  ) 

Shows the dialog.


Property Documentation

VARIANT_BOOL RW AllNonStorageItems

Enables the user to choose any item in the shell namespace, not just those with SFGAO_STREAM or SFAGO_FILESYSTEM attributes.

This flag cannot be combined with FOS_FORCEFILESYSTEM.

Only for new Vista file dialogs.

See also:
IFileDialog, FOS_ALLNONSTORAGEITEMS in the MSDN.
Default value: FALSE.

Since:
1.1.16.

VARIANT_BOOL RW AllowMultiselect

Specifies that the Dialog allows multiple selections.

See also:
OPENFILENAME, OFN_ALLOWMULTISELECT in the MSDN.

IFileDialog, FOS_ALLOWMULTISELECT in the MSDN.

Default value: FALSE.

Since:
1.1.16.

BSTR RW ClientGuid

Associates a GUID with a dialog's persisted state.

Only for new Vista file dialogs.

The dialog's state can include information about the last visited folder, the position and size of the dialog.

Example:

o = new ActiveXObject("Scripting.WindowSystemObject")

f = o.CreateForm(0,0,0,0)

f.ClientWidth = 500
f.ClientHeight = 300
f.CenterControl()

f.CreateButton(10,10,75,25,"Open 1").OnClick = function()
{
        var Dialog = f.CreateOpenDialog()
        Dialog.Filter = "All files (*.*)|*.*"
        Dialog.ClientGuid = "10000000-0000-0000-0000-000000000000"

        if (Dialog.Execute())
        {
                f.MessageBox(Dialog.FileName)
        }
}

f.CreateButton(100,10,75,25,"Open 2").OnClick = function()
{
        var Dialog = f.CreateOpenDialog()
        Dialog.Filter = "All files (*.*)|*.*"
        Dialog.ClientGuid = "20000000-0000-0000-0000-000000000000"

        if (Dialog.Execute())
        {
                f.MessageBox(Dialog.FileName)
        }
}


f.Show()

o.Run()

See also:
IFileDialog::SetClientGuid in MSDN.
Since:
1.1.16.

VARIANT_BOOL RW CreatePrompt

Prompt for creation if the item returned in the save dialog does not exist.

See also:
OPENFILENAME, OFN_CREATEPROMPT in the MSDN.

IFileDialog, FOS_CREATEPROMPT in the MSDN.

Default value: FALSE.

Since:
1.1.16.

BSTR RW DefaultExt

Gets or sets the default extension.

VARIANT_BOOL RW DefaultNoMiniMode

Indicates to the Save As dialog box that it should open in expanded mode.

See also:
IFileDialog, FOS_DEFAULTNOMINIMODE in the MSDN.
Default value: FALSE.

Since:
1.1.16.

BSTR RW Directory

Gets or sets the current directory for the dialog.

Returns empty string for a virtual folder.

VARIANT_BOOL RW DontAddToRecent

Do not save the item being opened or saved to the list of recent places.

See also:
OPENFILENAME, OFN_DONTADDTORECENT in the MSDN.

IFileDialog, FOS_DONTADDTORECENT in the MSDN.

Default value: FALSE.

Since:
1.1.16.

VARIANT_BOOL RW FileMustExist

Specifies that the user can type only names of existing files.

See also:
OPENFILENAME, OFN_PATHMUSTEXIST in the MSDN.

IFileDialog, FOS_PATHMUSTEXIST in the MSDN.

Default value: FALSE.

Since:
1.1.16.

BSTR RW FileName

Gets or sets the selected file name.

IDispatch* R FileNames

Return a Collection that contains list of the selected file names.

Can be used only in the OnCloseQuery event handler or after Execute method.

Example:

o = new ActiveXObject("Scripting.WindowSystemObject")

f = o.CreateForm(0,0,0,0)

f.ClientWidth = 500
f.ClientHeight = 300
f.CenterControl()

f.CreateButton(10,10,75,25,"Open").OnClick = function()
{
        var Dialog = f.CreateOpenDialog()
        Dialog.AllowMultiSelect = true
        Dialog.Filter = "All files (*.*)|*.*"
        if (Dialog.Execute())
        {
                var FileNames = Dialog.FileNames
                var Str = ""
                for (var i = 0; i<FileNames.Count; i++)
                {
                        Str += FileNames.item(i)
                        Str += "\r\n"           
                }
                f.MessageBox(Str)
        }
}


f.Show()

o.Run()

See also:
AllowMultiselect.
Since:
1.1.16.

BSTR RW Filter

Gets or sets the filter.

See the "Filter" argument of the OpenDialog method.

ULONG RW FilterIndex

Gets or sets the selected index of the filter selection combobox.

Minimum value 1.

ULONG RW Flags

See the "Flags" argument of the OpenDialog method.

VARIANT_BOOL RW ForceFileSystem

Ensures that returned items are file system items (SFGAO_FILESYSTEM).

Only for new Vista file dialogs.

See also:
IFileDialog, FOS_FORCEFILESYSTEM in the MSDN.
Default value: TRUE.

Since:
1.1.16.

VARIANT_BOOL RW ForcePreviewPaneOn

Indicates to the Open dialog box that the preview pane should always be displayed.

See also:
IFileDialog, FOS_FORCEPREVIEWPANEON in the MSDN.
Default value: FALSE.

Since:
1.1.16.

VARIANT_BOOL RW ForceShowHidden

Always show hidden items.

See also:
OPENFILENAME, OFN_FORCESHOWHIDDEN in the MSDN.

IFileDialog, FOS_FORCESHOWHIDDEN in the MSDN.

Default value: FALSE.

Since:
1.1.16.

VARIANT_BOOL RW HideMRUPlaces

Hide the list of places from which the user has recently opened or saved items.

See also:
IFileDialog, FOS_HIDEMRUPLACES in the MSDN.
Default value: FALSE.

Since:
1.1.16.

VARIANT_BOOL RW HidePinnedPlaces

Hide the list of pinned places from which the user can choose.

See also:
IFileDialog, FOS_HIDEPINNEDPLACES in the MSDN.
Default value: FALSE.

Since:
1.1.16.

VARIANT_BOOL RW NoDereferenceLinks

Shortcuts should not be treated as their target items, allowing an application to open a .lnk file.

See also:
OPENFILENAME, OFN_NODEREFERENCELINKS in the MSDN.

IFileDialog, FOS_NODEREFERENCELINKS in the MSDN.

Default value: FALSE.

Since:
1.1.16.

VARIANT_BOOL RW NoPlacesBar

If "TRUE", the places bar is not displayed.

Only for pre Vista file dialogs.

Default value: FALSE.

See also:
OPENFILENAME, OFN_EX_NOPLACESBAR in the MSDN.

VARIANT_BOOL RW NoReadOnlyReturn

Do not return read-only items.

See also:
OPENFILENAME, OFN_NOREADONLYRETURN in the MSDN.

IFileDialog, FOS_NOREADONLYRETURN in the MSDN.

Default value: FALSE.

Since:
1.1.16.

VARIANT_BOOL RW NoTestFileCreate

Do not test creation of the item returned in the save dialog.

See also:
OPENFILENAME, OFN_NOTESTFILECREATE in the MSDN.

IFileDialog, FOS_NOTESTFILECREATE in the MSDN.

Default value: FALSE.

Since:
1.1.16.

VARIANT W OnChange

Sets the event handler for the OnChange event.

This event occurs when the user changes the selection.

VARIANT W OnCloseQuery

Sets the event handler for the OnCloseQuery event.

This event occurs when the user tries to close the dialog.

VARIANT W OnFolderChange

Sets the event handler for the OnFolderChange event.

This event occurs when the user changes the current folder.

VARIANT W OnHelp

Sets the event handler for the OnHelp event.

This event occurs when the user clicks the "Help" button.

VARIANT W OnTypeChange

Sets the event handler for the OnTypeChange event.

This event occurs when the user changes the selected value of the filter combobox.

VARIANT_BOOL RW OverwritePrompt

Causes the Save As dialog box to generate a message box if the selected file already exists.

The user must confirm to overwrite the file

See also:
OPENFILENAME, OFN_OVERWRITEPROMPT in the MSDN.

IFileDialog, FOS_OVERWRITEPROMPT in the MSDN.

Default value: FALSE.

Since:
1.1.16.

VARIANT_BOOL RW PathMustExist

Specifies that the user can type only valid paths and file names.

See also:
OPENFILENAME, OFN_PATHMUSTEXIST in the MSDN.

IFileDialog, FOS_PATHMUSTEXIST in the MSDN.

Default value: FALSE.

Since:
1.1.16.

BSTR RW Text

Gets or sets the title of the dialog.


WSO 1.1 Documentation. Date modified:Wed Aug 12 18:12:34 2015. (C) Veretennikov A. B. 2004-2015