> -----Original Message-----
> From: Glenn Linderman [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, June 24, 2003 10:07 PM
> To: Win32 GUI
> Subject: [perl-win32-gui-users] no taskbar entry for a Win32::GUI
> program
> 
> 
>  From time to time the question has been asked on this list 
> about how to 
> have a Win32::GUI program running, but have no entry in the taskbar.
> 
> When hidden and disabled, no entry will appear, but when shown or 
> enabled, it will come back.
> 
> Unless, when you create the window, you use:
> 
>    -toolwindow => 1,
> 
> There is a more complicated solution, involving creating a fake main 
> window, making a real main window with the fake main window 
> as a parent, 
> and then deleting the fake main window.  This technique also 
> works, but
> is much more complex than the option above.


Glenn, I have not tried the above, but if it is what I "think" it is, then the 
third solution (one I currently use in an application) is to have your minimize 
and maximize events explicitly call hide() and disable() / show() and Enable() 
respectivly.  I wrap these up (with other stuff) in a if ($window->IsVisable()) 
block:

sub Window_Minimize {
        if ($Window->IsVisible){
                logit ("Window is Visible\n") if ($debug);
                $Window->Disable();
                logit ("Window Disabling\n") if ($debug);
                $Window->Hide();
                logit ("Window Hiding\n") if ($debug);
                $Window->CenterOnScreen();   #### Custom function added so it 
can be called as a method (it is a hack and probably not a good idea, but it 
does what I need it to do with no problems)
                $Window->NI->Modify( -id => 1, -tip => "Show PCKeys");
                $PopupMenu->{RestoreItem}->Enabled(1);
                $PopupMenu->{CloseItem}->Enabled(0);
                return 0;
        }
}


Then, since it is not visable in Task bar, etc, the only way to get back is via 
my TrayIcon and here I put code to reverse the process:

ub NI_Click {  ##### NI is the name of the trayICON
        if ($Window->IsVisible){
                $Window->Disable();
                $Window->Hide();
                $Window->CenterOnScreen();   #### Custom function added so it 
can be called as a method (it is a hack and probably not a good idea, but it 
does what I need it to do with no problems)

                $Window->NI->Modify( -id => 1, -tip => "Show PCKeys");
                $PopupMenu->{RestoreItem}->Enabled(1);
                $PopupMenu->{CloseItem}->Enabled(0);
                return 1;
        }
        else {
                $Window->NI->Modify( -id => 1,-tip => "Hide PCKeys");
                $PopupMenu->{RestoreItem}->Enabled(0);
                $PopupMenu->{CloseItem}->Enabled(1);
                $Window->Enable();
                $Window->CenterOnScreen();  #### Custom function added so it 
can be called as a method (it is a hack and probably not a good idea, but it 
does what I need it to do with no problems)
                $Window->Show();
                $Window->SetForegroundWindow();
                $CBdropdown->SetFocus();
                return 1;
        }
}

When I get around to it, I will try your find.  Thanks!



Reply via email to