Hello Anon Monk
I modified your code:
#!/usr/bin/perl --
use strict;
use warnings;
use Win32::SysTray;
sTray( @ARGV );
exit( 0 );
sub sTray {
my $tray = new Win32::SysTray (
'icon' => 'C:\images\logo.ico' ,
'single' => 1,
) or exit 0;
$tray->setMenu (
"> &Test" => sub { print "Hello from the Tray\n"; },
">-" => 0,
"> E&xit"=> sub { exit; },
);
begin( $tray );
}
sub begin {
my( $tray ) = @_;
die "user quit" if -1 == Poke( $tray );
}
#~ sub Win32::SysTray::Poke {
sub Poke {
my( $tray ) = @_;
print "\nWhat is your name? ";
chomp(my $name=<STDIN>);
print "\nHello $name\n\n";
Win32::GUI::DoEvents();
}
This is a smaller version from the larger program...a series of user inputs etc. When I run the above code it waits for an input....while I'm waiting for the input I would like to exit the program by clicking on the icon. That's what I'm trying to do....it works fine using your random number example. Thanks in advance.