quarta-feira, 30 de setembro de 2009

Mostrar todas as unidades mapeadas na máquina.

//1: Coloque um TListBox, TButton no form;
//2: Crie a seguinte procedure;

procedure TForm1.MapeamentosDisponiveis;
var
I : Integer;
Caminho, Drive : String;
Tamanho : Cardinal;
begin
SetLength(Caminho,255);
Tamanho:=255;
For I:=0 to 25 do
begin
Drive := Chr(Ord('A')+I)+':';
if WNetGetConnection(PChar(Drive),PChar(Caminho),Tamanho) = NO_ERROR then
ListBox1.Items.Add(LowerCase(Drive + ' - '+Caminho));
end;
end;

//2: Digite o código seguindo no evento OnClick do TButton;

Nenhum comentário:

Postar um comentário