Utilizamos cookies propias y de terceros. [Más información sobre las cookies].
Política de cookies
Proyecto AjpdSoft

· Inicio
· Buscar
· Contactar
· Cookies
· Descargas
· Foros
· Historia
· Nosotros
· Temas
· Top 10
· Trucos
· Tutoriales
· Wiki
Obtener lista de unidades de red a las que está conectado el PC y ruta - Delphi
Lenguaje de programación Borland Delphi


Añadiremos un formulario, un botón y un TMemo con el nombre "mUnidadesDeRed". En el USES del formulario pondremos "Windows". En el evento click del botón pondremos el siguiente código:

procedure TformMenuPrincipal.Button1Click(Sender: TObject);

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) <> ERROR_NOT_CONNECTED then
   SList.Add(I + ': ' + ThePath);
   {Devuelve el numero de conexiones}
   Result := SList.Count;
end;

begin
   GetNetworkDriveMappings(mUnidadesDeRed.Lines);
end;




Publicado el: 2003-10-14

Visita nuestro nuevo sitio web con programas y contenidos actualizados: Proyecto A