# BROWSEINFO结构翻译

BROWSEINFO结构
●定义
typedef struct_browseinfo
{
HWND  hwndOwner;
LPCITEMIDLIST pidlRoot;
LPSTR   pszDisplayName;
LPCSTR lpszTitle;
UINT      ulFlags;
BFFCALLBACK  lpfn;
LPARAM   lParam;
int      iImage;
}BROWSEINFO,*PBROWSEINFO,*LPBROWSEINFO;
●成员变量
hwndOwner：浏览文件夹对话框的父窗体句柄。
pidlRoot：ITEMIDLIST结构的地址，包含浏览时的初始根目录，而且只有被指定的目录和其子目录才显示在浏览文件夹对话框中。该成员变量可以是NULL，在此时桌面目录将被使用。
pszDisplayName：用来保存用户选中的目录字符串的内存地址。该缓冲区的大小缺省是定义的MAX_PATH常量宏。
lpszTitle：该浏览文件夹对话框对话框的显示文本，用来提示该浏览文件夹对话框的功能、作用和目的。
ulFlags：该标志位描述了对话框的选项。它可以为0，也可以是以下常量的任意组合：
BIF_BROWSEFORCOMPUTER：返回计算机名。除非用户选中浏览器中的一个计算机名，否则该对话框中的“OK”按钮为灰色。
BIF_BROWSEFORPRINTER：返回打印机名。除非选中一个打印机名，否则“OK”按钮为灰色。
BIF_BROWSEINCLUDEFILES：浏览器将显示目录，同时也显示文件。
BIF_DONTGOBELOWDOMAIN：在树形视窗中，不包含域名底下的网络目录结构。
BIF_EDITBOX：浏览对话框中包含一个编辑框，在该编辑框中用户可以输入选中项的名字。
BIF_RETURNFSANCESTORS：返回文件系统的一个节点。仅仅当选中的是有意义的节点时，“OK”按钮才可以使用。
BIF_RETURNONLYFSDIRS：仅仅返回文件系统的目录。例如：在浏览文件夹对话框中，当选中任意一个目录时，该“OK”按钮可用，而当选中“我的电脑”或“网上邻居”等非有意义的节点时，“OK”按钮为灰色。
BIF_STATUSTEXT：在对话框中包含一个状态区域。通过给对话框发送消息使回调函数设置状态文本。
BIF_VALIDATE：当没有BIF_EDITBOX标志位时，该标志位被忽略。如果用户在编辑框中输入的名字非法，浏览对话框将发送BFFM_VALIDATEFAILED消息给回调函数。
lpfn：应用程序定义的浏览对话框回调函数的地址。当对话框中的事件发生时，该对话框将调用回调函数。该参数可用为NULL。
lParam：对话框传递给回调函数的一个参数指针。
iImage：与选中目录相关的图像。该图像将被指定为系统图像列表中的索引值。

# BROWSEINFO结构原文

BROWSEINFO
Contains parameters for the SHBrowseForFolder function and receives information about the folder selected by the user.

typedef struct _browseinfo {
HWND hwndOwner;
LPCITEMIDLIST pidlRoot;
LPTSTR pszDisplayName;
LPCTSTR lpszTitle;
UINT ulFlags;
BFFCALLBACK lpfn;
LPARAM lParam;
int iImage;
} BROWSEINFO, *PBROWSEINFO, *LPBROWSEINFO;

Members
hwndOwner
Handle to the owner window for the dialog box.
pidlRoot
Pointer to an ITEMIDLIST structure (PIDL) specifying the location of the root folder from which to start browsing. Only the specified folder and any subfolders that are beneath it in the namespace hierarchy will appear in the dialog box. This member can be NULL; in that case, the namespace root (the desktop folder) is used.
pszDisplayName
Address of a buffer to receive the display name of the folder selected by the user. The size of this buffer is assumed to be MAX_PATH bytes.
lpszTitle
Address of a null-terminated string that is displayed above the tree view control in the dialog box. This string can be used to specify instructions to the user.
ulFlags
Flags specifying the options for the dialog box. This member can include zero or a combination of the following values: BIF_BROWSEFORCOMPUTER  Only return computers. If the user selects anything other than a computer, the OK button is grayed.
BIF_BROWSEFORPRINTER  Only return printers. If the user selects anything other than a printer, the OK button is grayed.
BIF_BROWSEINCLUDEFILES  Version 4.71. The browse dialog box will display files as well as folders.
BIF_BROWSEINCLUDEURLS  Version 5.0. The browse dialog box can display URLs. The BIF_USENEWUI and BIF_BROWSEINCLUDEFILES flags must also be set. If these three flags are not set, the browser dialog box will reject URLs. Even when these flags are set, the browse dialog box will only display URLs if the folder that contains the selected item supports them. When the folder's IShellFolder::GetAttributesOf method is called to request the selected item's attributes, the folder must set the SFGAO_FOLDER attribute flag. Otherwise, the browse dialog box will not display the URL.
BIF_DONTGOBELOWDOMAIN  Do not include network folders below the domain level in the dialog box's tree view control.
BIF_EDITBOX  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 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. To use this flag, you must call OleInitialize or CoInitialize before calling SHBrowseForFolder.
BIF_NONEWFOLDERBUTTON  Do not include the "New Folder" button in the browse dialog box.
BIF_RETURNFSANCESTORS  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_RETURNONLYFSDIRS  Only return file system directories. If the user selects folders that are not part of the file system, the OK button is grayed.
BIF_SHAREABLE  Version 5.0. The browse dialog box can display shareable resources on remote systems. It is intended for applications that want to expose remote shares on a local system. The BIF_USENEWUI flag must also be set.
BIF_STATUSTEXT  Include a status area in the dialog box. The callback function can set the status text by sending messages to the dialog box.
BIF_UAHINT 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_USENEWUI Version 5.0. Use the new user interface, including an edit box. This flag is equivalent to BIF_EDITBOX | BIF_NEWDIALOGSTYLE. To use BIF_USENEWUI, you must call OleInitialize or CoInitialize before calling SHBrowseForFolder.
BIF_VALIDATE  Version 4.71. If the user types an invalid name into the edit box, the browse dialog box will call the application's BrowseCallbackProc with the BFFM_VALIDATEFAILED message. This flag is ignored if BIF_EDITBOX is not specified.

lpfn
Address of an application-defined function that the dialog box calls when an event occurs. For more information, see the BrowseCallbackProc function. This member can be NULL.
lParam
Application-defined value that the dialog box passes to the callback function, if one is specified.
iImage
Variable to receive the image associated with the selected folder. The image is specified as an index to the system image list. 
• 点赞
• 评论
• 分享
x

海报分享

扫一扫，分享海报

• 收藏
• 打赏

打赏

xiaozhou_csdn

你的鼓励将是我创作的最大动力

C币 余额
2C币 4C币 6C币 10C币 20C币 50C币
• 举报
• 一键三连

点赞Mark关注该博主, 随时了解TA的最新博文

03-29

04-14 4468
08-15 938
12-05 1353
02-10 4152
09-02 468
07-30 752
04-10 7524
03-08 343
10-15 8099
03-30 722
05-27 1688
05-08 690