SHGetSpecialFolderPath函数的问题 [英] Problem With SHGetSpecialFolderPath Function

查看:84
本文介绍了SHGetSpecialFolderPath函数的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在使用

Hi,
I am using

SHGetSpecialFolderPath(0, path, CSIDL_PROGRAM_FILES, FALSE);


获取路径Program Files目录.如果我只有PC上的Program Files文件夹,它会很好用.
例如,我有两个"Program Files"文件夹是我的PC,一个在驱动器C&中.在运行代码时,它只能在安装了我的Windows的驱动器C中找到"Program Files"文件夹,而在驱动器D中找不到"Program Files"的路径.
我的问题是,如何更改功能也检查该文件夹的其他驱动器.
您还有其他执行此操作的功能吗?
问候


for get path Program files directory. it works good if I have on Program Files folder in my PC only.
For examples I have two "Program Files" folder is my PC, one in drive C & another in Drive D. When run code it only find "Program Files" folder in drive C that installed my windows and not finds path for "Program files" that located in drive D.
My question is how change function that check another drives for this folder too.
Is thee any other function that do this too?
Regards,

推荐答案

SHGetSpecialFolderPath仅适用于安装了驱动器窗口的情况.

如果您需要检查其他驱动器,则必须自己做.
SHGetSpecialFolderPath only works with the drive windows is installed on.

If you need to check other drive you will have to do that yourself.


您好,

SHGetSpecialFolderPath()是不可能的.此函数将仅返回有关CSIDL值的路径.

仅供参考:我们可以使用GetCurrentDirectory()
获取当前目录
GetModuleFileName():返回exe的路径.


谢谢
Hi,

It is not possible with SHGetSpecialFolderPath(). This function will return only the path of concerned CSIDL values.

FYI: We can get the current directory using GetCurrentDirectory(),

GetModuleFileName(): Return the exe''s path.


Thanks


似乎您的硬盘上安装了双操作系统.一个在C驱动器上,另一个在D驱动器上.当您在C驱动器上安装了OS引导时,当前OS(即C驱动器)中的特殊文件夹(例如MyDocument,ProgramFiles)将受到CLSID的青睐. D驱动器中的文件夹将只是操作系统的另一个文件夹.因此,无论何时使用SHGetSpecialFolderPath()API检索文件夹名称,您都将从当前的引导操作系统(即C盘)中获取路径.

如果要使用"Program Files"作为名称搜索所有文件夹(在所有驱动器上),则必须实现自己的逻辑.
It seems that you have dual OS installed on your hard disk. One on C Drive and the other on D Drive. When you boot with OS installed on C Drive the special folder (like MyDocument, ProgramFiles) from the current OS (i.e. from C Drive) will get liked to CLSIDs. The folders from D drive will be just an another folder for the OS. So, whenever you retrieve the folder name using SHGetSpecialFolderPath() API you''ll get the path from the current boot OS i.e. from C Drive.

If you wanna to search all the folder (on all the drives) with ''Program Files'' as name, you have to implement your own logic.


这篇关于SHGetSpecialFolderPath函数的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆