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

List All Network Drives

By Zarko Gajic, About.com

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
Zarko Gajic
Guide since 1998

Zarko Gajic
Delphi Programming Guide

Explore Delphi Programming
About.com Special Features

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

Easy ways to connect two computers for networking purposes. 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.