JavaScript Editor js editor     Web development 

Main Page

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

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



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.

Specifies the text for the directory list in the dialog box.

Specifies the caption to display in the dialog title bar. The Windows default is "Select Directory".

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



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.



Do not include network folders below the domain level in the tree view control (For example, My Computer and My Networks).



Return only file system ancestors. If a user selects anything other than a file system ancestor, the OK button is grayed.



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.



Validates the editbox contents. If the editbox is used, it is necessary to validate the user-specified content. If the user types an invalid name into the edit box, the Cancel button becomes the only selection available. This flag is ignored if BIF_EDITBOX is not specified.



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.



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.


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.

Return Value



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.

Beginning with Visual FoxPro 7, 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

JavaScript Editor js editor     Web development