• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1056
  • Last Modified:

Detect network drive

How to detect whether or not a drive is a network drive ?

1 Solution
\\HKEY_CURRENT_USER\Network\ contains a key for every currently mapped network drive.

example : Drive J is mapped to \\server\share the key would read
Values inside include path, login name, connection type, etc.

From this it is fairly simple to generate a list of network drives.  It's just a list of all the subkeys under \network\
Just use the GetDriveType function. If it returns 4 it is a network drive.
See Delphi online-help for details.

For better understanding:

if GetDriveType(PChar('R:\')) = 4 then ShowMessage('R:\ is a network drive');
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now