Hi,

I have a large ActiveState Perl 5.8 application, compiled to .exe
using their PDK. It uses a system tray icon to advertise its state
while it's running, using balloon tips. Sometimes, on some systems, it
crashes in GUI.dll. I have not been able to replicate or diagnose the
issue, and I'm hoping for some pointers for what might cause it. Not
using the system tray icon does appear to make the crashes stop.
Here's the systray subroutines:

## System tray icon subroutines ###############################################
sub EnableSystray {
    $systrayicon = new Win32::GUI::Icon('ldms_core.ico');
    $systraymain = Win32::GUI::Window->new(
        -name    => 'ldms_core_systray',
        -text    => 'ldms_core_systray',
        -width   => 20,
        -height  => 20,
        -visible => 0,
    );
    $systraymain->Enable();
    $popupMenu = Win32::GUI::Menu->new(
        "Options" => "Options",
        ">Manual" => {
            -name    => "Manual",
            -onClick => sub {
                open_browser(
'http://www.droppedpackets.org/scripts/ldms_core/ldms_core-manual'
                );
              }
        },
        ">EventViewer" => {
            -name    => "Event Viewer",
            -onClick => \&Eventvwr
        },
        ">Exit" => {
            -name    => "Exit",
            -onClick => \&systrayexit
        }
    );
    $systraynotify = $systraymain->AddNotifyIcon(
        -name         => "ldms_core_systray",
        -icon         => $systrayicon,
        -tip          => "$prog $VERSION running\n",
        -balloon_icon => "info",
        -onClick      => \&systraymenu,
        -onRightClick => \&systraymenu,

    );
    return 0;
}

sub ChangeBalloon {

    # Is the user trying to kill us?
    Win32::GUI::DoEvents() >= 0 or &LogDie("Killed by user.");

    # If systray support is off, just leave now
    if ( $showsystray == 0 ) { return 0; }

    # item can be title or tip
    # icon is fixed as "info"
    my $item  = shift;
    my $value = shift;
    $systraynotify->Change( "-balloon_$item" => $value );

    # this is to change the hovering tooltip
    $systraynotify->Change( -tip => $value, );
    $systraynotify->ShowBalloon(0);
    $systraynotify->ShowBalloon(1);
    return 0;
}

sub systraymain_Terminate {
    &LogDie("Killed by user");
    return 0;
}

sub systraymenu {
    $systraymain->TrackPopupMenu( $popupMenu->{Options} );
    return 1;
}

sub Eventvwr {
    system("eventvwr.msc");
    return 0;
}

sub systrayexit {
    &LogDie("Killed by user");
    return 0;
}


-- 
"I spent all me tin with the ladies drinking gin,
So across the Western ocean I must wander" -- traditional

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Perl-Win32-GUI-Users mailing list
Perl-Win32-GUI-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
http://perl-win32-gui.sourceforge.net/

Reply via email to