Module Module1
Public Sub Main()
Application.Run(New MyContext)
End Sub
End Module
Public Class MyContext
Inherits ApplicationContext
Private WithEvents TrayIcon As New NotifyIcon
Private WithEvents CMS As New ContextMenuStrip
Private WithEvents ExitMenu As New ToolStripMenuItem("Exit")
Public Sub New()
TrayIcon.Icon = My.Resources.Happy
TrayIcon.Text = "ApplicationContext with a NotifyIcon" ' <-- Tooltip on the NotifyIcon
TrayIcon.Visible = True
CMS.Items.Add(ExitMenu)
TrayIcon.ContextMenuStrip = CMS
' You can add a BackgroundWorker control to the class and start a lengthy process from here...
End Sub
Private Sub CMS_Opening(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles CMS.Opening
' From this event you can control which menu items appear (visibility or disabled) or
' even cancel the event and prevent the context menu from appearing at all
End Sub
Private Sub ExitMenu_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ExitMenu.Click
Application.Exit()
End Sub
Private Sub MyContext_ThreadExit(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.ThreadExit
TrayIcon.Visible = False
End Sub
End Class
Have a question about something in this article? You can receive help directly from the article author. Sign up for a free trial to get started.
Comments (10)
Commented:
As always brilliant and truly Genius IDLE_MIND.
Commented:
Commented:
Idle_Mind great Article. Thanks for sharing it.
I think the rumor is not rumor it is reality. ;) just kidding
Commented:
Great Article...
Commented:
Thanks for all your comments unfortuntately all seem to have a problem in that if "Enable application framework" is unchecked then the Splash Screen I have added is not called and displayed.
Any ideas?
Issac
View More