如何得到“桌面”及其下的子目录?

luo521 2001-11-16 12:22:48
资源管理器中“文件夹”界面:最上层是“桌面”,然后是“我的电脑”、驱动器A、C、D...;
...全文
42 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
szHenry 2001-11-16
  • 打赏
  • 举报
回复
from Help file come with Delphi 5 Wi32 Developer reference.

Folders and File Objects

A folder is a collection of items in the shell's namespace. A folder is analogous to a file system directory, and many folders are, in fact, directories. However, there are also other types of folders, such as remote computers, storage devices, the desktop folder, the Control Panel, the Printers folder, and the Fonts folder. A folder may contain other folders as well as items called file objects. A file object may be an actual file, or it can be a Control Panel application, a printer, or another type of object. Each type of folder can only contain certain kinds of file objects; for example, you cannot move a Control Panel application into a file system directory.

Because there are many kinds of folders and file objects, each folder is a OLE component object model (COM) object that "knows" how to enumerate its contents and carry out other actions. More precisely, each folder implements the IShellFolder interface. Retrieving the IShellFolder object for a shell folder is referred to as binding to the folder. An application that binds to a folder must eventually free the IShellFolder interface object by calling its Release member function.

You can bind to the desktop folder (retrieve the folder's IShellFolder interface) by using the SHGetDesktopFolder member function. You can enumerate subfolders by using the IShellFolder::EnumObjects member function. You can bind to a subfolder of any given folder by using the IShellFolder::BindToObject member function. Using these three functions, an application can navigate throughout the shell's entire namespace.
cobi 2001-11-16
  • 打赏
  • 举报
回复
关注

5,388

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧