#! perl -slw use strict; use threads; use Win32::GUI; my $mw = Win32::GUI::Window->new( -name => 'Main', -width => 500, -height => 500, ); my $lb = $mw->AddListbox( -name => 'LB' ); $lb->Add( 'Line ' . $_ ) for 1 .. 10; $mw->Show(); my $thread = async{ my $lb = shift; $SIG{'KILL'} = sub { return 0; }; my $n = 11; while( sleep 1 ) { $lb->Add( 'Line ' . $n++ ); } } $lb; $thread->detach; Win32::GUI::Dialog(); exit(0); sub Main_Terminate { $thread->kill( 'KILL' ); return -1; } sub Main_Resize { $lb->Width( $mw->Width ); $lb->Height( $mw->Height ); } sub LB_Click { print 'click'; } sub LB_MouseRightDown { print 'Rclick'; }