${res:Templates.Project.SysTrayIcon.Name}
VB
${res:Templates.File.Categories.WindowsApplications}
VB.Project.Form
${res:Templates.Project.SysTrayIcon.Description}
v2.0;v3.5Client
WinExe
Properties
WindowsFormsWithCustomSubMain
Program entry point.
''' Command Line Arguments
_
Public Shared Sub Main(args As String())
Application.EnableVisualStyles()
Application.SetCompatibleTextRenderingDefault(False)
Dim isFirstInstance As Boolean
' Please use a unique name for the mutex to prevent conflicts with other programs
Using mtx As New Mutex(True, "${StandardNamespace}", isFirstInstance)
If isFirstInstance Then
Dim notificationIcon As New NotificationIcon()
notificationIcon.notifyIcon.Visible = True
Application.Run()
notificationIcon.notifyIcon.Dispose()
' The application is already running
' TODO: Display message box or change focus to existing application instance
Else
End If
End Using
' releases the Mutex
End Sub
#End Region
#Region "Event Handlers"
Private Sub menuAboutClick(sender As Object, e As EventArgs)
MessageBox.Show("About This Application")
End Sub
Private Sub menuExitClick(sender As Object, e As EventArgs)
Application.[Exit]()
End Sub
Private Sub IconDoubleClick(sender As Object, e As EventArgs)
MessageBox.Show("The icon was double clicked")
End Sub
#End Region
End Class
]]>