最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Delphi - TOpenDialog does not show network mapped drives - Stack Overflow

programmeradmin3浏览0评论

I have an older app which was written with Delphi 5. It uses TOpenDialog for opening files. However, it does not show any of the mapped drives such as on the servers, only shows the physically attached drives like the C:\ drive or the USB flash drive. Is there a way to show shared network drives? If not, are there any alternatives that might do this?

I have an older app which was written with Delphi 5. It uses TOpenDialog for opening files. However, it does not show any of the mapped drives such as on the servers, only shows the physically attached drives like the C:\ drive or the USB flash drive. Is there a way to show shared network drives? If not, are there any alternatives that might do this?

Share Improve this question asked Mar 18 at 17:19 FarhätFarhät 596 bronze badges 3
  • TOpenDialog uses the Win32 GetOpenFileName() API. You can try calling that API directly with any options that Delphi 5 lacks. Better is to call the newer Vista+ IFileOpenDialog API instead (wrapped by TFileOpenDialog in modern Delphi versions), just copy the relevant API declarations into your own code. – Remy Lebeau Commented Mar 18 at 18:32
  • Thanks Remy. I tried using it but unfortunately, I still wasn't able to see the mapped drives. It shows the local drives on the computer but does not show the mapped drives on other computers such as Z:\ or Y:\ drives. – Farhät Commented Mar 19 at 19:40
  • 1 Please edit your question to provide more detail about your exact issue, with an example if possible. I just tried both TOpenDialog (without a manifest to force pre-Vista behavior) and TFileOpenDialog and had no trouble seeing and accessing a mapped network drive with both of them. – Remy Lebeau Commented Mar 19 at 21:28
Add a comment  | 

1 Answer 1

Reset to default 0

It turned out that newer versions of Windows (10 and 11) apparently do not allow showing mapped drives unless specifically set.

To address this, navigate in registry to:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System

Create a new DWORD value called EnableLinkedConnections and set its value to 1.

Restart the computer and then the mapped network drives will show in the dialog box with correct drive letters.

发布评论

评论列表(0)

  1. 暂无评论