Beranda > Delphi > Showing the network drive mappings

Showing the network drive mappings

To show a list of all mapped network drives, use the GetNetworkDriveMappings() function.  Example usage: GetNetworkDriveMappings(Memo1.Lines);function GetNetworkDriveMappings(SList: TStrings): integer;
{ Get a list of mapped network drives (if any). }
{ Code adapted from ZieglerSoft [http://www.zieglersoft.dk/uk.html] }

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;

Iklan
Kategori:Delphi
  1. Belum ada komentar.
  1. No trackbacks yet.

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

%d blogger menyukai ini: