WinXDialog_OpenFile$


fileName$ = WinXDialog_OpenFile$ (parent, title$, extensions$, initalName$, multiSelect)

Displays a standard Windows open file dialog box to allow the user to select a file to open.

Parameter Description
parent The parent window for the dialog box, 0 for none
title$ The title of the dialog box. Usually "Open file..."
extensions$ The file type filters, see remarks for more information
initialName$ The name of the file that is selected when the dialog box is first displayed, "" for none
multiSelect $$TRUE if the user can select multiple files. The files will be seperated by semi colons (;)

Returns

A string containing the file the user selected, or the empty string if the user cancelled the action.

Remarks

The extensions$ parameter is a list of file type filters. Each filter consists of a pair of strings, each ending with "\0". The first string in each pair is the file type displayed to the user. Normally it is in the format <type> files (*.<ex 1>, *.<ex 2> ..., <ex n>) where <type> is the type of file and <ex n> is one of the possible extensions. For example, "HTML files (*.htm, *.html)". The second string in each pair is a list of filters. For the HTML example, this string would be "*.htm;*.html". The final string in the list is terminated with another \0. The over all string for a dialog to open HTML files might be: "HTML files (*.htm, *.html)\0*.htm;*.html\0All files (*.*)\0*.*\0\0". Note the inclusion of the all files entry. This is found on most open dialog boxes.

If the use can select multiple files, each file will be sperated in the return value by a semi colon (;).

Examples

'Get a file from the user
fileName$ = WinXDialog_OpenFile$ (#hMain, "Open file", "All files (*.*)\0*.*\0\0", "", $$FALSE)

Related Links

WinXDialog_SaveFile$