1. Home
  2. Computing & Technology
  3. Delphi Programming

List All Network Drives

By , About.com Guide

To show a list of all mapped network drives, use the GetNetworkDriveMappings function. Example usage:

GetNetworkDriveMappings(Memo1.Lines) ;

function GetNetworkDriveMappings (SList: TStrings): integer;
var
   c: Char;
   ThePath: string;
   MaxNetPathLen: DWord;
begin
   SList.Clear;
   MaxNetPathLen := MAX_PATH;
   SetLength(ThePath, MAX_PATH) ;
   for c := 'A' to 'Z' do
     if WNetGetConnection(PChar('' + c + ':'), PChar(ThePath),MaxNetPathLen) = NO_ERROR then sList.Add(c + ': ' + ThePath) ;
   Result := SList.Count;
end;
Delphi tips navigator:
» Get IE Favorites
« TColor to Hex & Hex to TColor
Explore Delphi Programming
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. Delphi Programming
  4. Coding Delphi Applications
  5. Delphi Tips and Tricks
  6. 2001 Delphi Tips
  7. Programmatically List All Network Drives using Delphi

©2009 About.com, a part of The New York Times Company.

All rights reserved.