Click or drag to resize

GetDir Function

X#
-- todo --
Displays the Select Directory dialog box from which you can choose a directory.

Namespace:  XSharp.VFP
Assembly:  XSharp.VFP (in XSharp.VFP.dll) Version: 2.21
Syntax
 FUNCTION GetDir(
	cDirectory,
	cText,
	cCaption,
	nFlags,
	lRootOnly
) AS STRING CLIPPER
Request Example View Source

Parameters

cDirectory (Optional)
Type: Usual
Specifies the directory that is initially displayed in the dialog box. When cDirectory is not specified, the dialog box opens with the X# default directory displayed.
cText (Optional)
Type: Usual
Specifies the text for the directory list in the dialog box.
cCaption (Optional)
Type: Usual
Specifies the caption to display in the dialog title bar. The Windows default is "Select Directory".
nFlags (Optional)
Type: Usual
Specify the options for the dialog box. nFlags can include zero or an additive combination of the values.
The table in the remarks section includes some of more common flags. For more information, see SHBrowseForFolder in MSDN.
lRootOnly (Optional)
Type: Usual
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

Type: String
Character
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.
Beginning with X# 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, X# uses the SHBrowseForFolder routine from the Win32 API to provide the dialog.
nFlagValueDescription
1BIF_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.
32BIF_VALIDATE 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.
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.
See Also