Network'e bağlanmış sürücü listesi alma

Yazdığınız makaleleri ve üyelerimizin işine yarayacağını düşündüğünüz kodlarınızı gönderebilirsiniz. Bu foruma soru sormayın!
Cevapla
DotCom
Kıdemli Üye
Mesajlar: 1696
Kayıt: 11 Tem 2003 10:30
Konum: İzmir
İletişim:

Network'e bağlanmış sürücü listesi alma

Mesaj gönderen DotCom »

Kod: Tümünü seç

Function GetNetworkDriveMappings(SList:TStrings):Integer;
Var
I:Char;
ThePath:String;
MaxNetPathLen:DWord;
Begin
SList.Clear;
MaxNetPathLen:=MAX_PATH;
SetLength(ThePath,MAX_PATH);
For I := 'A' to 'Z' Do
If WNetGetConnection(
PChar(''+I+':'),PChar(ThePath),
MaxNetPathLen)=NO_ERROR Then
SList.Add(I+': '+ThePath);
Result := SList.Count;
End;
// Kullanımı:

Kod: Tümünü seç

procedure TForm1.Button1Click(Sender: TObject);
begin
GetNetworkDriveMappings(Form1.ListBox1.Items);
end;
Cevapla