Notify Icon not being displayed

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
You might want to try declaring tray as NotifyIcon in the form
declarations, rather than as a local variable.

T
 
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
 
Back
Top