FileSelectPopup

int FileSelectPopup (char defaultDirectory[], char defaultFileSpec[], char fileTypeList[], char title[], int buttonLabel, int restrictDirectory, int restrictExtension, int allowCancel, int allowMakeDirectory, char pathName[]);

Purpose

Displays a file selection dialog box and waits for the user to select a file or cancel.

Parameters

Input
Name Type Description
defaultDirectory string Initial directory.

If you enter "", the function uses the current working directory.

The maximum length of the default directory is MAX_PATHNAME_LEN bytes, including the NUL byte.

Note   If you set restrictDirectory to Yes, "" is not valid for defaultDirectory. You must pass a valid directory name in this case.
defaultFileSpec string String that specifies which files to display. For example, "*.c" causes all files with the .c extension to be displayed.

The defaultFileSpec appears in the filename box when you initially display the pop-up. If you specify an actual filename, such as test.c, that name appears in the filename box and also in the file list box.

The default file specification (spec) cannot contain a directory path.

The maximum length of the default file spec is 255 bytes.
fileTypeList string List of file types, separated by semicolons, to display in the file type list of the File Select Pop-up dialog box when restrictExtension is FALSE.

For example, "*.c; *.h" allows the user to select "*.c" or "*.h" from the file type list. The all files, *.*, option is always available.

The maximum length of the file type list is 255 bytes.
title string Title of the dialog box.
buttonLabel integer The label for the file select button. You can select from the following choices:

OK = VAL_OK_BUTTON
Save = VAL_SAVE_BUTTON
Select = VAL_SELECT_BUTTON (affects existing files only)
Load = VAL_LOAD_BUTTON (affects existing files only)
restrictDirectory integer If nonzero, the user cannot change directories or drives.

If zero, the user can change directories or drives.
restrictExtension integer If nonzero, the user is limited to files with the default extension.

If zero, the user can select files with any extension.
allowCancel integer If nonzero, the user can cancel out of the File Select Pop-up dialog box.

If zero, the user can leave the pop-up dialog box only by making a selection.
allowMakeDirectory integer If nonzero, allows the user to make a new directory from the File Select Pop-up dialog box. This option is useful when a user wants to save a file into a new directory.
Output
Name Type Description
pathName string Buffer in which the user selection is returned.

The buffer must be at least MAX_PATHNAME_LEN bytes long.

Return Value

Name Type Description
selectionStatus integer The selection status or error codes generated during the function call.

0 VAL_NO_FILE_SELECTED
1 VAL_EXISTING_FILE_SELECTED
2 VAL_NEW_FILE_SELECTED

Negative values indicate that an error occurred.