Hello there,

i try to use a notifyicon (but nothing else from Win32::GUI). My prog should
be able to change the icon and detect mouseclicks. I managed so far, thar an
changing icon gets displayed, but failed to create interaction. As soon as i
move the mouse over the icon, it disappears and my program looses the
connection (Change returns 0 instead of 1).
Please give me a hint!

Thanks in advance,
Harry



use Win32::GUI;
$|=1;
$icon1=new Win32::GUI::Icon("id.ico");
$icon2=new Win32::GUI::Icon("id_high.ico");

$tt=new
Win32::GUI::NotifyIcon(undef,-id=>1,-name=>"NI",-tip=>"Test",-icon=>$icon1);

while()
{
  Win32::GUI::DoEvents;
  print ".";
  $x++; 
  if ($x==5)  { print $tt->Change(-id=>1,-icon=>$icon2); }
  if ($x==10) { print $tt->Change(-id=>1,-icon=>$icon1); $x=0; }
  # Wanna do some real work here ...
  select (undef,undef,undef,0.25);
}

sub NI_Click
{
  print "CLICKED(".join(",",@_).")";
  1;
}

sub NI_MouseEvent
{
  print "MOUSEEVENT(".join(",",@_).")";
  1;
}



Reply via email to