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 |1 Answer
Reset to default 0It 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.
TOpenDialog
uses the Win32GetOpenFileName()
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 byTFileOpenDialog
in modern Delphi versions), just copy the relevant API declarations into your own code. – Remy Lebeau Commented Mar 18 at 18:32TOpenDialog
(without a manifest to force pre-Vista behavior) andTFileOpenDialog
and had no trouble seeing and accessing a mapped network drive with both of them. – Remy Lebeau Commented Mar 19 at 21:28