Home All Groups Group Topic Archive Search About

Notify Icon not being displayed

Author
24 Jul 2006 5:15 PM
iwdu15
hi, im using this code to display a notifyicon object with information
provided at runtime

Protected Overrides Sub WndProc(ByRef m As Message)

        MyBase.WndProc(m)

        If m.Msg = WM_SYSCOMMAND Then

            Select Case m.WParam.ToInt32

                Case 1000

                    Dim tray As New NotifyIcon

                    tray.Icon = Icon.FromHandle(m.HWnd)
                    tray.Visible = True

                    AddHandler tray.DoubleClick, AddressOf
NotifyIcon1_DoubleClick

                    SendMessage(m.HWnd.ToInt32, 0, Nothing, Nothing)

            End Select

        End If

    End Sub


what i am attempting to do is recreate a project i saw on CodeProject where
you add a menu "Tray Me" to the System menu and when a user clicks on it, the
window is hidden and an icon is displayed, yet this doesnt work....any help
would be great, thanks

--
-iwdu15

Author
25 Jul 2006 3:25 PM
tomb
You might want to try declaring tray as NotifyIcon in the form
declarations, rather than as a local variable.

T

iwdu15 wrote:

Show quoteHide quote
>hi, im using this code to display a notifyicon object with information
>provided at runtime
>
>Protected Overrides Sub WndProc(ByRef m As Message)
>
>        MyBase.WndProc(m)
>
>        If m.Msg = WM_SYSCOMMAND Then
>
>            Select Case m.WParam.ToInt32
>
>                Case 1000
>
>                    Dim tray As New NotifyIcon
>
>                    tray.Icon = Icon.FromHandle(m.HWnd)
>                    tray.Visible = True
>
>                    AddHandler tray.DoubleClick, AddressOf
>NotifyIcon1_DoubleClick
>
>                    SendMessage(m.HWnd.ToInt32, 0, Nothing, Nothing)
>
>            End Select
>
>        End If
>
>    End Sub
>
>
>what i am attempting to do is recreate a project i saw on CodeProject where
>you add a menu "Tray Me" to the System menu and when a user clicks on it, the
>window is hidden and an icon is displayed, yet this doesnt work....any help
>would be great, thanks
>

>
Author
25 Jul 2006 3:43 PM
iwdu15
i have tried declaring it locally and globally and neither work. I am
attempting to create a program that will be able to put any application in
the system tray....so i need to make a NotifyIcon at run time......any
suggestions would be great, thanks
--
-iwdu15
Author
25 Jul 2006 4:06 PM
Michele
place a notify icon on your form and set visible as you want.

Show quoteHide quote
"iwdu15" <jmmgoalsteratyahoodotcom> ha scritto nel messaggio
news:C4E7725C-2745-48E3-9220-6D123F62EF0A@microsoft.com...
>i have tried declaring it locally and globally and neither work. I am
> attempting to create a program that will be able to put any application in
> the system tray....so i need to make a NotifyIcon at run time......any
> suggestions would be great, thanks
> --
> -iwdu15