NotifyIcon plug-in

From NSIS Wiki
Jump to navigationJump to search
Author: Afrow UK (talk, contrib)


Links

NotifyIcon.zip (24 KB)

Description

This is an excellent plugin by brainsucker to create a NotifyIcon on the Windows System Tray. The plugin is very flexible, allowing custom icons, custom text, % install completed etc.

This plugin was created after this topic.

Readme

This readme was changed from its original version in the zip file. Those changes are not marked.
-- deguix

To use:

NotifyIcon::Icon Flags Arguments

Flags is a string of letters with special meaning. Some of such flags need 
some arguments to be passed, in this case they most follow flags specification
in the order flags describe them. :) I never was the master of explaining how
any of my plugins works ;)

So, the flags:
        a       -       add icon*   
        m       -       modify icon*
        r       -       remove icon
                * - these flags will be autodetected, but can be overridden

The following 4 flags could be inverted with '!' char before them (to reset them
to the default state). In this case ('!p') the p flag requires no argument.

        x       -       show taskbar item in minimized state (by default no)
        y       -       show NotifyIcon in normal state (by default no)
        z       -       hide NotifyIcon in minimized state (by default no)

        p       -       indicate progress as tip (requeries argument, tip format.
                        Should look like "it's a progress tip %d%%" or something
                        like that. %% adds % sign, and %d places progress value.

        i       - icon as integer (installer resource icon) (1 arg integer)
        s       - icon as integer (system icon) (1 arg integer)
        f       - icon as file (1 arg file name)
        h       - icon as handle (1 arg handle - integer)

        t       - tip (1 arg - string)

        b       - balloon tooltip without marks (2 args, Title and Tip itself)
        n       - balloon tooltip with INFO mark (2 args, Title and Tip itself)
        w       - balloon tooltip with WARNING mark (2 args, Title and Tip itself)
        e       - balloon tooltip with ERROR mark (2 args, Title and Tip itself)

        o       - set the balloon tooltip timeout (1 arg integer timeout in ms)
                  windows allows values between 10 and 30.

Tip 1. Balloon tooltips are available only at version 5.8 of Comctl32.dll
(Internet Explorer 5.0). At lower versions they will be ignored.

Example:
1)   NotifyIcon::Icon "yitb" 103 "Just a tip" "Balloon!" "Cool!" 

     Create notify icon (will always be at tray), with default installer icon.   

2)   NotifyIcon::Icon "fbp" "icon.ico" "Cool Installer" "Installation started" "Completed %d%%"

     Create notify icon from icon.ico, show startup balloon, and use progress
     as icon tip.

3)   NotifyIcon::Icon "!pt" "Tip is back!"

     Remove progress tips and redefine your tip.

4)   NotifyIcon::Icon "r"
        
     Remove icon from tray.
     Can cause crashes if called in the wrong place in your script.
     Ideally should be called in .onGUIEnd, but works in other places.
     The plugin automatically calls the remove routine with .onGUIEnd
     when the installer closes.

Nik Medved (brainsucker)

-Stu

Credits

NotifyIcon plug-in - © 2003 Nik Medved (brainsucker), http://brains.by.

Unicode port and x64 tweaks by Jason Ross aka JasonFriday13.