chessgui has asked for the wisdom of the Perl Monks concerning the following question:

I play correspondence chess and I would like a perl application which sits in the background and at regular intervals scans the net to see whether there are games of my turn. I would like it to sink in the system tray and have no taskbar icon. I know there is Gtk2::TrayIcon but this is only for notification (it won't remove the taskbar icon). My questions:

1. Is it theoretically possible to have a perl app with a tray icon but no taskbar icon?

2. Is it even possible to build Gtk2 on Win32? I've tried this earlier but have given up hope. However in the case of an other module which also seemed hopeless (WWW::Mechanize::Firefox) I could make it through manual methods involving 'look' suggested by Anonymous Monk. I've tried my new knowledge on Gtk2 but it still fails:
Package gobject-2.0 was not found in the pkg-config search path. Perhaps you should add the directory containing `gobject-2.0.pc' to the PKG_CONFIG_PATH environment variable No package 'gobject-2.0' found at Makefile.PL line 60
I've edited the PKG_CONFIG_PATH environment variable manually to point at gobject-2.0.pc but to no avail.

ps. I would be happy to write this even in C++ and launch the main perl app from there. I've succeeded to write a little C++ app with a system tray icon but to remove the taskbar icon I would need the MFC classes which is included only in the professional version of Visual C++ (costing thousands of dollars).

Replies are listed 'Best First'.
Re: System tray application
by Anonymous Monk on Jan 29, 2012 at 17:44 UTC
      Thank you, these are very useful links.

      Win32::SysTray I could put to work:
      use strict; use Win32::SysTray; my $tray = new Win32::SysTray ( 'icon' => '/Icons/Application.ico', 'single' => 1, ) or exit 0; $tray->setMenu ( "> &Test" => sub { print "Hello from the Tray\n"; }, ">-" => 0, "> E&xit" => sub { return -1 }, ); $tray->runApplication;
      Also I have found an example where with Win32::GUI the entire taskbar can be hidden:
      use Win32::GUI; my $taskbar = Win32::GUI::FindWindow("Shell_TrayWnd", ""); Win32::GUI::Hide($taskbar); sleep(3); Win32::GUI::Show($taskbar);
      Since building Gtk2 may be beyond my capabilities on the other hand Win32::GUI is already available and seems to have similar capabilities I ask:

      Is it possible by using pure Win32::GUI to switch off the taskbar icon for an app?

      update: build-gtk-glib-post.PL fails:
      Can't open gtk_bundle/lib/pkgconfig/libglade-2.0.pc: No such file or d +irectory. Error GETing http://www.gtk.org/download-windows.html: Not Found at gt +kinst.pl line 113

        I would rather figure out how to compile/deploy Gtk2, than dicker with Win32::GUI

        Oh noes, the url changed, what do now? :p

        http://www.gtk.org/download/win32.php

Re: System tray application
by chessgui (Scribe) on Jan 29, 2012 at 19:05 UTC
    PROBLEM SOLVED (at least for Win32):

    You should run the Win32::SysTray application via wperl.exe and there you are! Wperl.exe creates neither a new window nor a taskbar icon.

      Or you could use  Win32::SetChildShowWindow( 0 );

      Oh the circles, they're so round :D

        This idea failed to come to me because I've used wperl.exe with Tk apps which ultimately open a window and therefore create a taskbar icon. So I did not associate 'wperl.exe' with 'no taskbar icon' in my mind only with 'no window'.