'Network Drive'에 해당되는 글 1건

  1. 2007/09/18 List All Network Drives
2007/09/18 08:31

List All Network Drives

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
    ifWNetGetConnection(PChar('' + c + ':'), PChar(ThePath),MaxNetPathLen) = NO_ERROR then sList.Add(c + ': ' + ThePath) ;
  Result := SList.Count;
end;
Trackback 0 Comment 0