use Tk; use Win32::FileOp; my $mw = MainWindow -> new; my $frmWidth = 452; my $frmHeigt = 50; my $screenypos = $mw->screenheight(); my $screenxpos = $mw->screenwidth(); $screenxpos = $screenxpos - $frmWidth; $screenxpos = $screenxpos/2; $screenypos = $screenypos - $frmHeigt; $screenypos = $screenypos/2; $mw->geometry("${frmWidth}x$frmHeigt+$screenxpos+$screenypos"); $mw->resizable('no', 'no'); $mw->title ("Test"); my $mainFrame = $mw -> Frame -> pack (-side => 'top', -padx => '8', -pady => '10'); $BrowseFrame = $mainFrame -> Frame() -> pack (-side => 'top', -pady => '5'); $BrowseFrame -> Button (-text => 'Select folder', -command => \&gotoFile, -background => '#ccccff', -activebackground => '#6666ff') -> pack (-side => 'left', -padx => '5'); $BrowseFrame -> Entry (-textvariable => \$filepath, -width => '84', -background => '#ccccff') -> pack (-side => 'left', -padx => '2'); $mw->update; MainLoop; sub gotoFile { $filepath = BrowseForFolder ("Choose Directory", CSIDL_DRIVES, BIF_RETURNONLYFSDIRS); $mw->Unbusy; return 'Cancel' unless($filepath); return; }