The SkyBlue_Minimize sub should do the trick. I've used the other code before and it's worked out well. Hope this helps.
#=================== sub SkyBlue_Minimize #=================== { $window->Hide(); return 0; } #================= sub _Systray_Click #================= { if($window->IsVisible) { $window->Hide(); } else { $window->Show(); } } #====================== sub _Systray_RightClick #====================== { _Systray_Click(); } Regards, David -----Original Message----- From: Sky Blueshoes [mailto:[EMAIL PROTECTED] Sent: Thursday, February 16, 2006 11:33 AM To: perl-win32-users@listserv.ActiveState.com Subject: Minimize to Tray I'm using Win32::GUI to create a system tray icon. The window hides and everything when you click on the system tray, but how do I bind the minimize button to hide the window like when you click the system tray? I think I'm missing an event sub, but I don't know what to call it. use strict; use Win32::GUI; my ($systray_icon, $window, $win); local $SIG{'HUP' } = sub{ $systray_icon->Delete( $window, -id => 1); exit; }; my $hwnd = GUI::GetPerlWindow(); $window = new GUI::Window(-name => "SkyBlue"); GUI::Hide($hwnd); $win = 1; $systray_icon = $window->AddNotifyIcon( -name => "_Systray", -id => 1, -icon => new Win32::GUI::Icon('skyblue.ico'), -tip => "Minimize to Tray"); sub _Systray_Click { if ($win) { GUI::Show ($hwnd); $win = 0; } else { GUI::Hide ($hwnd); $win = 1; } } SkyBlueshoes _______________________________________________ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs _______________________________________________ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs