use strict; use Win32::GUI (); $|=1; my $window = Win32::GUI::Window->new(); my $menu = new Win32::GUI::Menu( "mymenu" => "mymenu", " > foo" => "foo", " > bar" => { -name => 'bar', -onClick => \&bar_onclickcallback }, ); print "Start Tracking\n"; $window->TrackPopupMenu($menu->{mymenu}, 20,20); Win32::GUI::Dialog(); # enter Dialog() here print "Done Tracking, if it didn't print 'GOTCHA ...' then no callback?\n"; sub bar_onclickcallback { print "GOTCHA bar\n"; return -1; # return -1 here to exit from dialog loop } sub foo_Click { print "GOTCHA foo\n"; return -1; # return -1 here to exit from dialog loop }