Partager via


GETDIR( ) Function

Displays the Select Directory dialog box from which you can choose a directory.

GETDIR([cDirectory [, cText [, cCaption [, nFlags [, lRootOnly]]]]])

Return Values

Character

Parameters

  • cDirectory
    Specifies the directory that is initially displayed in the dialog box. When cDirectory is not specified, the dialog box opens with the Visual FoxPro default directory displayed.
  • cText
    Specifies the text for the directory list in the dialog box.
  • cCaption
    Specifies the caption to display in the dialog title bar. The Windows default is "Browse for Folder".
  • nFlags
    Specify the options for the dialog box. nFlags can include zero or an additive combination of the values. The following table includes some of more common flags. For more information, see SHBrowseForFolder in MSDN.
    nFlag Value Description
    1 BIF_RETURNONLYFSDIRS Return only file system directories (physical locations). If a user selects folders that are not part of the file system, the OK button is grayed.
    2 BIF_DONTGOBELOWDOMAIN Do not include network folders below the domain level in the tree view control (For example, My Computer and My Networks).
    8 BIF_RETURNFSANCESTORS Return only file system ancestors. If a user selects anything other than a file system ancestor, the OK button is grayed.
    16 BIF_EDITBOX The browse dialog includes an edit control in which the user can type the name of an item. Available on Windows 98 and above, or with Internet Explorer 4.0 or higher (assuming shell integration option selected). Requires version 4.71 of shell32.dll.
    64 BIF_NEWDIALOGSTYLE Use the new user-interface. Setting this flag provides the user with a larger, resizable dialog box. Additional functionality includes: drag and drop capability within the dialog box, reordering, context menus, new folders, delete, and other context menu commands. Support in Windows 2000 and above. Requires version 5.00 of shell32.dll.
    16384 BIF_BROWSEINCLUDEFILES The browse dialog will display files as well as folders. Available on Windows 98 and above, or with Internet Explorer 4.0 or higher (assuming shell integration option selected). Requires version 4.71 of shell32.dll.
  • lRootOnly
    Specifies that only cDirectory and its subfolders display. This parameter prevents navigation above the root folder. If you do not specify cDirectory, the default directory (SET DEFAULT value) is used.

Remarks

GETDIR( ) returns as a character string the name of the directory you choose.

If you do not choose a directory (you click Cancel, press ESC, or choose Close from the window menu), GETDIR( ) returns the empty string.

In this version of Visual FoxPro, GETDIR( ) supports two different dialog boxes. If you provide fewer than three parameters, GETDIR( ) returns the dialog box from earlier versions. If you provide more than two parameters, Visual FoxPro uses the SHBrowseForFolder routine from the Win32 API to provide the dialog.

See Also

DIRECTORY | DIRECTORY( ) | GETEXPR | GETFILE( )