Fórum Mapear pasta #171595
26/07/2003
0
valewwwwwwwwwwwwwwww 8)
::d::a::m::m::i::t::
Curtir tópico
+ 0Posts
26/07/2003
Cdaraujo
Veja:
procedure TForm1.Button1Click(Sender: TObject);
var
NRW: TNetResource;
begin
with NRW do
begin
dwType:=RESOURCETYPE_ANY;
lpLocalName:=´G:´;
lpRemoteName:=´\\rede_conections\C´;
lpProvider:=´´;
end;
WNetAddConnection2(NRW, ´Senha´, ´UserName´, CONNECT_UPDATE_PROFILE);
end;
Atenciosamente,
Daniel Araújo
Gostei + 0
26/07/2003
::d::a::m::m::i::t::
Gostei + 0
26/07/2003
Cdaraujo
Veja um exemplo para listar as conexões da rede.
Atenciosamente,
Daniel Araújo
procedure TForm1.FormCreate(Sender: TObject);
var
i : Integer;
Count, Size, rc : Cardinal;
NetHandle : THandle;
NetResources : Array of TNetResource;
begin
// abre enumeração
if WNetOpenEnum(RESOURCE_CONNECTED, RESOURCETYPE_ANY, 0, nil, NetHandle) <> NO_ERROR then
Exit;
try
// tamanho inicial de NetResources
SetLength(NetResources,50);
try
while True do begin
// pega o máximo de elementos
Count := Cardinal(-1);
Size := Length(NetResources)*SizeOf(TNetResource);
// pega as conexões
rc := WNetEnumResource(NetHandle, Count, @NetResources[0], Size);
// tamanho insuficiente. aumenta-o
if rc = ERROR_MORE_DATA then begin
SetLength(NetResources, Round(Size/Sizeof(TNetResource)+0.5));
Continue;
end;
if rc <> NO_ERROR then
Exit;
// preenche a listbox
for i := 0 to Count - 1 do
with NetResources[i] do
ListBox1.Items.Add(lpRemoteName)
end;
finally
NetResources := Nil;
end;
finally
// fecha a enumeração
WNetCloseEnum(NetHandle);
end;
end;
Gostei + 0
27/07/2003
4_olho
http://www.forumweb.com.br/index.php?showtopic=2774&st=0entry11792
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)