NotifyIcon for beginners

Hi,

I would like some help generating an EXE file that is able to receive arguments (or switches) and display a balloon popup with whatever info it receives (like TITLE, BODY,TIMEOUT,ON_CLICK_ACTION or something like that)... No forms are needed in this project - I only need the balloon in the systray (to display important messages).

I will probably use NotifyIcon - but how is this done and is it possible to do when I'm a n00b

Using VB Express for the first time right now...




Answer this question

NotifyIcon for beginners

  • Sue Hoegemeier

    You're welcome !!!!!



  • Donal Kelly

    Great thanx!

    I've been looking "everywhere" for the GetCommandLineArgs line :) Then rest I might be able to use - just need to rethink my "design" a bit.

    Thank you again!



  • Pham

    I'm not sure exactly what you were acking for but it's a good first pass.

    Public Class Form1

        Protected Friend WithEvents ni As New NotifyIcon

        Protected Friend WithEvents ctxmnu As New ContextMenuStrip

        Protected Str() As String = System.Environment.GetCommandLineArgs()

        Protected mevargs As System.Windows.Forms.MouseEventArgs

        Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

            ni.Icon = Me.Icon

            Me.ShowInTaskbar = False

            ni.Visible = True

            ctxmnu.Items.Add("this is a context menu")

            ni.ContextMenuStrip = ctxmnu
            Me.visible = False

        End Sub

     

        Private Sub ni_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ni.Click

            Dim selected As Boolean = mevargs.Button = Windows.Forms.MouseButtons.Right

            If My.Computer.Mouse.ButtonsSwapped Then selected = Not selected

            If selected Then

                ctxmnu.Show()

            Else

                If Str.Length > 1 Then

                    ni.BalloonTipText = Str(1)

                Else

                    ni.BalloonTipText = "no command line"

                End If

                ni.ShowBalloonTip(5)

            End If

     

     

        End Sub

        Private Sub ni_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ni.MouseDown

            mevargs = e

        End Sub

    End Class

     

     Please note that this editor breaks up the original formating and makes one line look like multiple lines. If you see syntax errors join two lines.



  • NotifyIcon for beginners