473,322 Members | 1,703 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

RE: NotifyIcon Click events not firing

Hello Jason,

Thanks for using Microsoft Newsgroup Support Service, my name is Ji Zhou
[MSFT] and I will be working on this issue with you.

I have tried to but cannot reproduce your issue on my side. From your
codes, I think the logical is, every time the Timer's elapsed event fires,
we call the Check_For_Version_Update() function. From the
Check_For_Version_Update() function, we judge a condition statement, and
determine whether to call Notification() function. In the Notification()
function, we show our balloon tip, right?

For I do not see your codes in the Check_For_Version_Update() function. I
write my simulated version to test on my side. The whole codes are as
follows,

Public Class Form1
Dim WithEvents tmrUpdateCheckTimer As System.Timers.Timer

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
tmrUpdateCheckTimer = New System.Timers.Timer()
tmrUpdateCheckTimer.Interval = 3000
tmrUpdateCheckTimer.Enabled = True
End Sub
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

Private Sub Check_For_Version_Update()
Dim findUpdateVersion = True
If (findUpdateVersion) Then
Notification("Test Title", "Test Body", "http://localhost")
End If
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 = ""
End If
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
End Class

No matter I run the application within Visual Studio or deploy it and run
it at client machines. It always works as expected. The click event of
NotifyIcon and BallonTip fires OK. I can see the message box to pop up, as
well as the target site's launching. One important thing to be mentioned is
that, in the Notification() function, I have changed the codes

If Len(ActionURL) 0 Then NotifyIcon.Tag = ActionURL Else
NotifyIcon.Tag = ""

to

If Len(ActionURL) 0 Then
NotifyIcon.Tag = ActionURL
Else
NotifyIcon.Tag = ""
End If

Actually, without the End If statement, the NotifyIcon.Tag="" will always
be executed. So, at the later time, the target site will never be launched.
This may be problematical in the design logical, but I do not think it will
result into the message box's not poping up.

To do a future investigation on this issue and narrow down the problem,
would you mind to send me an setup msi file of your test project? So, I can
try to setup the application on my side, and run it to see what the problem
is there. You can access me by this email address, v-****@microsoft.com

Have a nice day!

Best regards,
Ji Zhou (v-****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subs...#notifications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://support.microsoft.com/select/...tance&ln=en-us.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Oct 31 '08 #1
1 4253
reply.

The IF-Then-Else statement that you noticed on two lines is actually on a
single line in my code and works just fine. But, I re-formatted it and added
the End If anyways.

I created a temporary application and pasted your code into it, added a
NotifyIcon to the form and assigned an icon to it for testing purposes. Both
the NotifyIcon Click event and the NotifyIcon.BaloonClick events worked
correctly under VS2008 and as a standalone application. So, what's the
difference between my original code and this test application? I started
experimenting a bit.

I dug into the form designer code and found the following:

My original code was:
'
'NotifyIcon
'
Me.NotifyIcon.BalloonTipIcon = System.Windows.Forms.ToolTipIcon.Info
Me.NotifyIcon.BalloonTipText = "Click to visit the website for more
information."
Me.NotifyIcon.BalloonTipTitle = "An Update is available for IAS"
Me.NotifyIcon.Icon = CType(resources.GetObject("NotifyIcon.Icon"),
System.Drawing.Icon)
Me.NotifyIcon.Text = "IAS Notifications"

The test app was:
'
'NotifyIcon
'
Me.NotifyIcon.Icon = CType(resources.GetObject("NotifyIcon.Icon"),
System.Drawing.Icon)
Me.NotifyIcon.Text = "NotifyIcon"
Me.NotifyIcon.Visible = True
I pasted the test app code over the original app code as an experiment.
Then I set the initial visibility to false. Now, when I run the app, the
events appear to fire correctly under VS2008 and on two other machines.

So, I assume that one of the differences above had an un-intended side
effect that was causing the failure.

Thanks for your help.

Jason
"""Ji Zhou [MSFT]""" wrote:
Hello Jason,

Thanks for using Microsoft Newsgroup Support Service, my name is Ji Zhou
[MSFT] and I will be working on this issue with you.

I have tried to but cannot reproduce your issue on my side. From your
codes, I think the logical is, every time the Timer's elapsed event fires,
we call the Check_For_Version_Update() function. From the
Check_For_Version_Update() function, we judge a condition statement, and
determine whether to call Notification() function. In the Notification()
function, we show our balloon tip, right?

For I do not see your codes in the Check_For_Version_Update() function. I
write my simulated version to test on my side. The whole codes are as
follows,

Public Class Form1
Dim WithEvents tmrUpdateCheckTimer As System.Timers.Timer

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
tmrUpdateCheckTimer = New System.Timers.Timer()
tmrUpdateCheckTimer.Interval = 3000
tmrUpdateCheckTimer.Enabled = True
End Sub
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

Private Sub Check_For_Version_Update()
Dim findUpdateVersion = True
If (findUpdateVersion) Then
Notification("Test Title", "Test Body", "http://localhost")
End If
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 = ""
End If
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
End Class

No matter I run the application within Visual Studio or deploy it and run
it at client machines. It always works as expected. The click event of
NotifyIcon and BallonTip fires OK. I can see the message box to pop up, as
well as the target site's launching. One important thing to be mentioned is
that, in the Notification() function, I have changed the codes

If Len(ActionURL) 0 Then NotifyIcon.Tag = ActionURL Else
NotifyIcon.Tag = ""

to

If Len(ActionURL) 0 Then
NotifyIcon.Tag = ActionURL
Else
NotifyIcon.Tag = ""
End If

Actually, without the End If statement, the NotifyIcon.Tag="" will always
be executed. So, at the later time, the target site will never be launched.
This may be problematical in the design logical, but I do not think it will
result into the message box's not poping up.

To do a future investigation on this issue and narrow down the problem,
would you mind to send me an setup msi file of your test project? So, I can
try to setup the application on my side, and run it to see what the problem
is there. You can access me by this email address, v-****@microsoft.com

Have a nice day!

Best regards,
Ji Zhou (v-****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subs...#notifications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://support.microsoft.com/select/...tance&ln=en-us.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Oct 31 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Rob Mayo | last post by:
OK, maybe this is my opinion, maybe these are bugs. Given the folowing: I have a NotifyIcon on my Form, a Context menu associated with the NotifyIcon, and a MenuItem on the ContextMenu set as...
3
by: Glen | last post by:
Can anyone tell me if there is a workable method to get the mouse cursor position on the screen or the NotifyIcon position? I need to display a context menu for the NotifyIcon when clicked and I'd...
1
by: Earl Teigrob | last post by:
PROBLEM: When a user control is loaded into a PlaceHolder control more than once, the events do not fire on the first click of a control on the dynamically loaded user control. In other words, the...
2
by: Heather R | last post by:
I am writing a windows service that has a notifyicon component. The component displays accordingly, but for some reason, I cannot get the click or double click event to fire. It seems like none of...
0
by: ZH | last post by:
Hi There, I have an application that runs from the systray. When the user right clicks on the icon it shows the user a list of of menu items. That works without a problem. The problem is...
1
by: Marcel Brekelmans | last post by:
Hello, I have implemented a NotiFyIcon and am using both DoubleClick and Click events. But the Doubleclick action on my icon also fires the Click event. Am I missing some setting somewhere or is...
0
by: nospam | last post by:
I have an application that is made up of a single module for my global variables and then multiple classes. There is no form. I am using a notifyicon as my notification(Basically different...
0
by: =?Utf-8?B?anAybXNmdA==?= | last post by:
I have a ContextMenuStrip that I added to my NotifyIcon. Whenever the Main Form has been hidden, the NotifyIcon can be right-clicked, and the Operators can select "Show Form." The...
8
by: starrysky | last post by:
I have a program which puts an icon in the notification area and has a menu associated with it available by right clicking on the icon. I want the menu items to be selected by single left clicks but...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.