OWLNext 7.0
Borland's Object Windows Library for the modern age
|
The file open common dialog box serves as a consistent replacement for the many different types of dialog boxes applications have used to open files.
TOpenSaveDialog::TData has several members you must initialize before constructing the dialog box object. You can either initialize them by assigning values, or you can use TOpenSaveDialog::TData 's constructor, which takes the most common parameters, Flags, Filter, CustomFilter, InitialDir, and DefExt, with default arguments of zero.
TData member | Type | Description |
FileName | char* | The selected file name. On input, it specifies the default file name. On output, it contains the selected file name. |
Filter | char* | The file name filters and filter patterns. Each filter and filter pattern is in the form filter|filter pattern|... where filter is a text string that describes the filter and filter pattern is a DOS wildcard file name. You can repeat filter and filter pattern for as many filters as you need. You must separate them with | characters. |
CustomFilter | char* | Lets you specify custom filters. |
FilterIndex | int | Specifies which of the filters specified in Filter should be displayed by default. |
InitialDir | char* | The directory to be displayed on opening the file dialog box. Use zero for the current directory. |
DefExt | char* | Default extension appended to FileName if the user does not type an extension. If DefExt is zero, no extension is appended. |
In this example, a file-open common dialog box prompts the user for a file name. If an error occurred (Execute returns IDCANCEL and Error returns nonzero), a message box is displayed.