J
Jason
I have an application where I use the NotifyIcon and it's Baloon tip to
notify users when a new version of the application is available.
In the NotifyIcon.Click and NotifyIcon.BalloonTipClicked events, I have code
that closes the NotifyIcon and opens a URL using the users default browser.
This code consistently works just fine when the application runs under
Visual Studio and the VSHost but the events fail to fire when the application
is deployed to client machines (confirmed on both XP and Vista.)
I've added a test message box that gives me positive notification when the
click event is processed in my code so I know that the code works fine under
VS2008, but not from a standalone copy of the application.
In addition, as part of my troubleshooting, I have added <STAThread()> _
Sub main() to my main entry point in order to force Single Threaded
Apartment on my application, but this hasn't helped.
The pertinent code elements are shown below:
Private Sub tmrUpdateCheckTimer_Elapsed(ByVal sender As Object, ByVal e As
System.Timers.ElapsedEventArgs) Handles tmrUpdateCheckTimer.Elapsed
'When this timer event is triggered, check for updates and notify
the user.
'Disable the timer for the rest of the session.
Me.tmrUpdateCheckTimer.Enabled = False
If My.Computer.Network.IsAvailable Then Check_For_Version_Update()
End Sub
Public Sub Notification(ByVal Title As String, ByVal Body As String,
Optional ByVal ActionURL As String = "")
Me.NotifyIcon.BalloonTipTitle = Title
Me.NotifyIcon.BalloonTipText = Body
If Len(ActionURL) > 0 Then NotifyIcon.Tag = ActionURL Else
NotifyIcon.Tag = ""
Me.NotifyIcon.Visible = True
Me.NotifyIcon.ShowBalloonTip(9)
End Sub
Private Sub NotifyIcon_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles NotifyIcon.Click
MsgBox("Clicked 2", MsgBoxStyle.OkOnly, "Test: Click Detection")
Call NotifyIcon_BalloonTipClicked(sender, e)
End Sub
Private Sub NotifyIcon_BalloonTipClicked(ByVal sender As Object, ByVal e
As System.EventArgs) Handles NotifyIcon.BalloonTipClicked
MsgBox("Clicked", MsgBoxStyle.OkOnly, "Test: Click Detection")
If Len(NotifyIcon.Tag.ToString) > 0 Then
Dim myTargetURL As String = NotifyIcon.Tag.ToString
System.Diagnostics.Process.Start(myTargetURL)
Application.DoEvents()
End If
Me.NotifyIcon.Visible = False
End Sub
Thanks,
Jason
This message was cross posted in Visual Basic Language Forum also.
notify users when a new version of the application is available.
In the NotifyIcon.Click and NotifyIcon.BalloonTipClicked events, I have code
that closes the NotifyIcon and opens a URL using the users default browser.
This code consistently works just fine when the application runs under
Visual Studio and the VSHost but the events fail to fire when the application
is deployed to client machines (confirmed on both XP and Vista.)
I've added a test message box that gives me positive notification when the
click event is processed in my code so I know that the code works fine under
VS2008, but not from a standalone copy of the application.
In addition, as part of my troubleshooting, I have added <STAThread()> _
Sub main() to my main entry point in order to force Single Threaded
Apartment on my application, but this hasn't helped.
The pertinent code elements are shown below:
Private Sub tmrUpdateCheckTimer_Elapsed(ByVal sender As Object, ByVal e As
System.Timers.ElapsedEventArgs) Handles tmrUpdateCheckTimer.Elapsed
'When this timer event is triggered, check for updates and notify
the user.
'Disable the timer for the rest of the session.
Me.tmrUpdateCheckTimer.Enabled = False
If My.Computer.Network.IsAvailable Then Check_For_Version_Update()
End Sub
Public Sub Notification(ByVal Title As String, ByVal Body As String,
Optional ByVal ActionURL As String = "")
Me.NotifyIcon.BalloonTipTitle = Title
Me.NotifyIcon.BalloonTipText = Body
If Len(ActionURL) > 0 Then NotifyIcon.Tag = ActionURL Else
NotifyIcon.Tag = ""
Me.NotifyIcon.Visible = True
Me.NotifyIcon.ShowBalloonTip(9)
End Sub
Private Sub NotifyIcon_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles NotifyIcon.Click
MsgBox("Clicked 2", MsgBoxStyle.OkOnly, "Test: Click Detection")
Call NotifyIcon_BalloonTipClicked(sender, e)
End Sub
Private Sub NotifyIcon_BalloonTipClicked(ByVal sender As Object, ByVal e
As System.EventArgs) Handles NotifyIcon.BalloonTipClicked
MsgBox("Clicked", MsgBoxStyle.OkOnly, "Test: Click Detection")
If Len(NotifyIcon.Tag.ToString) > 0 Then
Dim myTargetURL As String = NotifyIcon.Tag.ToString
System.Diagnostics.Process.Start(myTargetURL)
Application.DoEvents()
End If
Me.NotifyIcon.Visible = False
End Sub
Thanks,
Jason
This message was cross posted in Visual Basic Language Forum also.