Ask (display Windows file dialog)

Top  Previous  Next

 

Ask( [ file queue] [, restore path ] )

Ask

Displays the Windows file dialog.

file queue

The label of a QUEUE structure that receives information for the selected files. The structure must be the same as the SelectFileQueue structure declared in ABUTIL.INC. If omitted, the end user may select only one file, for which the Ask method returns the full pathname.

restore path

An integer constant, variable, EQUATE, or expression that indicates whether to restore the current path to its pre-file dialog state. A restore path value of one (1) restores the current path; a value of zero (0) does not restore the current path. If omitted, restore path defaults to zero (0).

The Ask method displays the Windows file dialog and returns information, primarily the full pathname, for the selected file or files.

Implementation:

The file queue parameter must name a QUEUE that begins the same as the SelectFileQueue structure declared in ABUTIL.INC:

SelectFileQueue QUEUE,TYPE

Name             STRING(File:MaxFilePath)

ShortName        STRING(File:MaxFilePath)

               END

Return Data Type:     STRING

Example:

FileQ      SelectFileQueue       !declare FileName QUEUE

FileQCount BYTE

CODE

!program code

SelectFile.Ask(FileQ,0)         !multi file dialog, don't restore directory

LOOP FileQCount=1 TO RECORDS(FileQ) !for each selected file

 GET(FileQ,FileQCount)          !get the file information

 MESSAGE(FileQ.Name)            !process the file

END

 

FileNames = SelectFile.Ask(1)   !single file dialog, restore directory