描述
显示一个对话框,使用户可以选择文件夹.
FreeBASIC 语法
FUNCTION AfxBrowseForFolder ( - BYVAL hwnd AS HWND, _ BYVAL pwszTitle AS WSTRING PTR = NULL, _ BYVAL pwszStartFolder AS WSTRING PTR = NULL, _ BYVAL nFlags AS LONG = 0 _ ) AS CWSTR |
参数
hwnd
[in]到对话框的父窗口的句柄.此值可以为零.
pwszTitle
[in]可选.表示浏览对话框中显示的标题的字符串值.
pwszStartFolder
[in]可选.对话框将显示的初始文件夹.
nFlags
[in]可选.一个LONG价值包含方法的选择.这可以是上市的BROWSEINFO结构ulFlags成员价值观下的零或组合.
BIF_RETURNONLYFSDIRS (&H00000001)
Only return file system directories. If the user selects folders that are not part of the file system, the OK button is grayed.
BIF_DONTGOBELOWDOMAIN (&H00000002)
Do not include network folders below the domain level in the dialog box's tree view control.
BIF_STATUSTEXT (&H00000004)
Include a status area in the dialog box. The callback function can set the status text by sending messages to the dialog box. This flag is not supported when BIF_NEWDIALOGSTYLE is specified.
BIF_RETURNFSANCESTORS (&H00000008)
Only return file system ancestors. An ancestor is a subfolder that is beneath the root folder in the namespace hierarchy. If the user selects an ancestor of the root folder that is not part of the file system, the OK button is grayed.
BIF_EDITBOX (&H00000010)
Version 4.71. Include an edit control in the browse dialog box that allows the user to type the name of an item.
BIF_NEWDIALOGSTYLE (&H00000040)
Version 5.0. Use the new user interface. Setting this flag provides the user with a larger dialog box that can be resized. The dialog box has several new capabilities, including: drag-and-drop capability within the dialog box, reordering, shortcut menus, new folders, delete, and other shortcut menu commands.
Note If COM is initialized through CoInitializeEx with the COINIT_MULTITHREADED flag set, AfxShellBrowserForFolder fails if BIF_NEWDIALOGSTYLE is passed.
BIF_USENEWUI
Version 5.0. Use the new user interface, including an edit box. This flag is equivalent to BIF_EDITBOX OR BIF_NEWDIALOGSTYLE.
Note If COM is initialized through CoInitializeEx with the COINIT_MULTITHREADED flag set, AfxShellBrowserForFolder fails if BIF_USENEWUI is passed.
BIF_UAHINT (&H00000100)
Version 6.0. When combined with BIF_NEWDIALOGSTYLE, adds a usage hint to the dialog box, in place of the edit box. BIF_EDITBOX overrides this flag.
BIF_NONEWFOLDERBUTTON (&H00000200)
Version 6.0. Do not include the New Folder button in the browse dialog box.
BIF_NOTRANSLATETARGETS (&H00000400)
Version 6.0. When the selected item is a shortcut, return the PIDL of the shortcut itself rather than its target.
BIF_BROWSEFORCOMPUTER (&H00001000)
Only return computers. If the user selects anything other than a computer, the OK button is grayed.
BIF_BROWSEFORPRINTER (&H00002000)
Only allow the selection of printers. If the user selects anything other than a printer, the OK button is grayed.
In Windows XP and later systems, the best practice is to use a Windows XP-style dialog, setting the root of the dialog to the Printers and Faxes folder (CSIDL_PRINTERS).
BIF_BROWSEINCLUDEFILES (&H00004000)
Version 4.71. The browse dialog box displays files as well as folders.
BIF_SHAREABLE (&H00008000)
Version 5.0. The browse dialog box can display shareable resources on remote systems. This is intended for applications that want to expose remote shares on a local system. The BIF_NEWDIALOGSTYLE flag must also be set.
BIF_BROWSEFILEJUNCTIONS (&H00010000)
Windows 7 and later. Allow folder junctions such as a library or a compressed file with a .zip file name extension to be browsed.
备注
如果你不通过任何旗帜,该函数将使用BIF_RETURNONLYFSDIRS或BIF_DONTGOBELOWDOMAIN或BIF_USENEWUI或BIF_RETURNFSANCESTORS
显示旧风格的对话框,在nFlags参数1通.
返回值
选定文件夹的路径.
用法示例
DIM cws AS CWSTR = AfxBrowseForFolder(hwnd, "C:")
引用文件
AfxWin.inc