我收到了客户的错误报告。我的程序使用Delphi的选择目录功能,让他选择程序使用的几个目录,这些目录允许在网络驱动器上。以下是错误报告的相关摘录:
When trying to change the directory the network drives were not shown in the dialog. When opening "Computer" in the browse menu only local drives were shown. The roundabout solution is to leave the dialog open, disconnect the network drive, and re-connect the network drive. It then appears in the dialog. When changing the next folder location it must be done all over again. I found out that the main technician has been doing this frequently as it seems to reset.
一开始我以为这一定是Windows没有拾取目录,所以我让他检查两台计算机(客户端和带有网络驱动器的计算机)上的网络位置是否设置为工作,以检查驱动器已映射到客户端,以检查网络发现是否已打开,并检查他是否可以在资源管理器中正常看到驱动器。他做到了,但错误仍然存在。
我没有在谷歌或质量控制报告中发现任何与此相关的内容,documentation对于 SelectDirExtOpts 似乎建议网络驱动器应该“正常工作”。
所以我的问题:以前有人遇到过类似的事情吗?可能是 Windows 问题,还是 Delphi 问题?
非常感谢。
最佳答案
只要包含 sdShowShares
标志,它确实应该可以工作。
如果您查看 SelectDirectory
函数的源代码,您会发现它只不过是为 SHBrowseForFolder
设置内容并读取结果。
SHBrowseForFolder
是 Windows Shell API 函数:
function SHBrowseForFolder; external shell32 name 'SHBrowseForFolderW';
Delphi 必须正确解释从 SHBrowseForFolder
返回的结果,因为驱动器在重新连接后会正确显示。所以我认为这是客户端计算机上的 Windows 问题。
关于windows - Delphi SelectDirectory与网络驱动器的奇怪行为,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13392293/