windows - Delphi SelectDirectory与网络驱动器的奇怪行为

标签 windows delphi

我收到了客户的错误报告。我的程序使用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/

相关文章:

javascript - 如何: Simulate click OK in WebBrowser alert/messagebox that initiated by a JavaScript?(德尔福)

delphi - 如何在运行时在 FireMonkey 中使用鼠标选择 3D 对象

c++ - 如何使用 C++ 将日期设置为我选择的下一个工作日?

java - 使用 java 将文件复制到本地网络中的计算机并进行身份验证

windows - WinAPI:InternetCloseHandle 函数关闭句柄但不关闭连接

delphi - Delphi XE2/XE3和Windows 8平板电脑/手机

windows - 当作为远程桌面应用程序运行时,Delphi TOpenDialog 在 Windows 2008 中挂起

database - 适当的数据库为 Delphi、Firemonkey 存储 20 GB

c - 如何从C中的内存映射文件读取bin文件(FAT16分区)?

c - 如何将缓冲区放入 CompletionROUTINE 作为 WSARecvFrom 调用的一部分?