类似于 Windows 资源管理器的文件夹树浏览器

发布于 2024-07-16 08:01:11 字数 324 浏览 3 评论 0原文

我正在尝试实现一个独立于平台的文件/目录树浏览器。 基本上,我试图复制 Windows 资源管理器的树控件来浏览计算机。 但是,我不知道如何找到“桌面”或“我的电脑”文件夹字符串(它在每个电脑和操作系统类型、版本和语言中都会变化)。 如果我能找到一种方法来获取最顶层的文件夹字符串,那么我就可以向下遍历并有望填充树。 某处是否有注册表字符串?

最初,我只针对 MS Windows 操作系统(XP、Vista 等),但后来我计划也支持 Linux 和 Mac。 我使用 wxWidgets 作为我的 GUI,但我愿意接受针对这个特定问题的所有建议。 哦,我在 VS2008 中使用 C++。

I am trying to implement a platform independent file/directory tree browser. Basically, I am trying to replicate windows explorer's tree control to browse the computer. However, I can't figure out how to find the "Desktop" or "My Computer" folder string (It changes in every pc and os type, version and language). If I can find a way to get the topmost folder string, than I can traverse down and populate the tree hopefully. Is there a registry string somewhere?

Initially, I will only target MS Windows os'es (XP, Vista, etc) but later I plan to support Linux and Macs as well. I use wxWidgets for my GUI but I am open to all suggestions for this specific problem. Oh, and I am using C++ in VS2008.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

丶情人眼里出诗心の 2024-07-23 08:01:11

忽略可移植性,您需要的是“PIDL”树。 PIDL 是文件路径的概括。 您可以使用 SHGetFolderLocation 获取特殊文件夹的 PIDL。 桌面是 CSIDL_DESKTOP不是 CSIDL_DESKTOPDIRECTORY),我的电脑是 CSIDL_DRIVES

要将 PIDL 转换为名称,请查看 SHGetNameFromIDList

Ignoring portability, what you need is the "PIDL" tree. PIDLs are generalizations of file paths. You can get the PIDLs for special folders with SHGetFolderLocation. The desktop is CSIDL_DESKTOP (not CSIDL_DESKTOPDIRECTORY), My Computer is CSIDL_DRIVES.

To convert the PIDLs to names, have a look at SHGetNameFromIDList

盗梦空间 2024-07-23 08:01:11

查看 SHGetFolderPath 函数。

Take a look at SHGetFolderPath function.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文