use strict; use Win32::NetResource qw(:DEFAULT GetSharedResources GetError); use Tk; use Tk::HList; use Tk::ItemStyle; my @names; if(@ARGV) {@names = @ARGV;} else { @names = ("computer1", "computer2", "computer3", "computer4"); } my $mw = MainWindow->new(); $mw->title("Visible shares"); $mw->resizable("false", "false"); my $hlist = $mw->Scrolled('HList',-scrollbars => "osoe"); my $boldfont = $mw -> fontCreate(-weight => 'bold'); my $boldstyle = $hlist->ItemStyle("text", -font => $boldfont); $hlist->configure(-width => 50, -height => 40, -separator => '/'); foreach (@names) { if (GetSharedResources(my $resources, RESOURCETYPE_ANY, { RemoteName => "\\\\" . $_ })) { $hlist->add("$_", '-text' => "$_", -style => $boldstyle); foreach my $href (@$resources) { my $sharename = (split(/\\/, $href->{RemoteName}))[-1]; $hlist->add("$_/$href->{RemoteName}", '-text' => "$sharename"); } } # if ends } #foreach ends $hlist->pack(); MainLoop;