Ver Mensaje Individual
  #4  
Antiguo 27-01-2008
Avatar de cHackAll
[cHackAll] cHackAll is offline
Baneado?
 
Registrado: oct 2006
Posts: 2.159
Reputación: 22
cHackAll Va por buen camino
Código Delphi [-]
var Items: array [0..32767] of TNetResource;

procedure AddResources(NodeName: string; List: TStrings);
var hEnum, Count, Size: Cardinal;
begin
 Items[0].lpRemoteName := PChar(NodeName);
 Count := $FFFFFFFF; Size := SizeOf(Items);
 WNetOpenEnum(RESOURCE_GLOBALNET, RESOURCETYPE_DISK, 0, @Items, hEnum);
 WNetEnumResource(hEnum, Count, @Items, Size);
 WNetCloseEnum(hEnum);
 while LongBool(Count) do
  begin
   Dec(Count);
   List.Add(Items[Count].lpRemoteName);
  end;
end;
 
type
 PWkstaInfo100 = ^TWkstaInfo100;
 TWkstaInfo100 = record
  wki100_platform_id: Cardinal;
  wki100_computername,
  wki100_langroup: PWideChar;
  wki100_ver_major,
  wki100_ver_minor: Cardinal;
 end;
 
function NetWkstaGetInfo(server: PWideChar; level: Cardinal; bufptr: Pointer): Cardinal; stdcall; external 'netapi32.dll';
 
procedure TForm1.Button1Click(Sender: TObject);
var
 Info: PWkstaInfo100;
 Index: Cardinal;
begin
 if not LongBool(NetWkstaGetInfo(nil, 100, @Info)) and Assigned(Info) then
  begin
   ListBox1.Items.Clear;
   AddResources(string(Info.wki100_langroup), ListBox1.Items);
   LocalFree(Cardinal(Info));
   Index := ListBox1.Count;
   while LongBool(Index) do
    begin
     AddResources(ListBox1.Items[0], ListBox1.Items);
     ListBox1.Items.Delete(0);
     Dec(Index);
    end;
  end;
end;

El anterior código hace lo que necesitas (enumerar las carpetas compartidas en tu grupo de trabajo), tambien lo he dejado como truco para futuras busquedas.

PD: connor no repitas los hilos, lo óprimo hubiese sido que contunues el anterior hilo o que lo aclares.

Saludos
Responder Con Cita