Solved

my system tray icon's tooltip is not updating.

Posted on 2000-03-19
10
432 Views
Last Modified: 2012-05-04
Hi,

  I'm using a system tray icon.  I can add the icon to the tray just fine and whatever nid.szTip was set to show up just dandy as the tooltip.
  I would like the tooltip to change.  I've tried changing nid.szTip and then calling Shell_NotifyIcon(NIM_MODIFY, nid), which is set to

Public Declare Function Shell_NotifyIcon Lib "SHELL32" _
(ByVal dwMessage As Long, pnid As NOTIFYICONDATA) As Boolean

Public Const NIM_MODIFY = &H1

What am I doing wrong here?

Removing the icon works fine too.

tia.
0
Comment
Question by:lmathers
  • 5
  • 5
10 Comments
 
LVL 14

Expert Comment

by:mcrider
Comment Utility
Do you have nid defined as public?

   Public nid As NOTIFYICONDATA

If not, it needs to be... Then you do this:

   nid.szTip = "My New Tip" & vbNullChar
   Shell_NotifyIcon NIM_MODIFY, nid


Cheers!®©
0
 
LVL 14

Expert Comment

by:mcrider
Comment Utility
Also, see the following microsoft KB article:

HOWTO: Use the System Tray Directly from Visual Basic
http://support.microsoft.com/support/kb/articles/Q176/0/85.ASP?LNG=ENG&SA=MSDN&FR=0


Cheers!®©
0
 
LVL 14

Expert Comment

by:mcrider
Comment Utility
This microsoft KB article is also QUITE HELPFUL!

HOWTO: Manipulate Icons in the System Tray with Visual Basic
http://support.microsoft.com/support/kb/articles/Q162/6/13.asp?LNG=ENG&SA=MSDN&FR=0


Cheers!®©
0
 

Author Comment

by:lmathers
Comment Utility
Well, yes nid is public

Public nid As NOTIFYICONDATA

and here is the code I'm using to update the icon.

nid.szTip = "blah" & vbNullChar
Shell_NotifyIcon NIM_MODIFY, nid

I have read the ms docs on dealing with system tray icons.  In fact, I've pretty much copied their stuff.  However, it's still not working.

Shell_NotifyIcon returns true when I execute the above.  Meanwhile, the tooltip is not being updated.

0
 
LVL 14

Expert Comment

by:mcrider
Comment Utility
Bizzare!  Can you run the example in:

HOWTO: Manipulate Icons in the System Tray with Visual Basic
http://support.microsoft.com/support/kb/articles/Q162/6/13.asp?LNG=ENG&SA=MSDN&FR=0

By the way, that example requires a CommonDialog control to be added to the form in addition to the 2 command buttons. (The article fails to mention this)

Run the example and then click the "Add an Icon" button.  Then go down to the System Tray and hover over the new icon.

You should see: "Taskbar status area Sample Program"

Right click on the icon and a change the tip, then hover over it again...

If you can get this working, then something is definately wrong with your program and you will need to post the source...


Cheers!®©
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 

Author Comment

by:lmathers
Comment Utility
Well, I was hoping it was something wrong with my program, but....

I copied the source code and created the project.

I right-clicked on the icon, filled in a random string into the box that popped up and the tooltip still says:
"Taskbar Status Area Sample Program".

Is this time for me to say uh-oh?
0
 
LVL 14

Accepted Solution

by:
mcrider earned 50 total points
Comment Utility
If you built the program *EXACTLY* as the MS article said to and the tooltips didn't change, it's time for a BIG UH-OH!

What version of VB are you using??  If you are using VB5 or VB6, you need to have Service Pack 3 installed...

See the following MS article:

INFO: Visual Studio 97 Service Packs - What, Where, and Why
http://support.microsoft.com/support/kb/articles/Q170/3/65.ASP


Cheers!®©
0
 

Author Comment

by:lmathers
Comment Utility
ARGH!

I'm running VB6 SP3.

I just solved the problem.

I restarted my computer, now it works perfectly.

How, so very microsoft!

Thank you for your time.
0
 

Author Comment

by:lmathers
Comment Utility
Thanks for taking time to help out.
0
 

Author Comment

by:lmathers
Comment Utility
I did try just restarting VB, so it was a logoff/logon or restart that fixed the problem, whatever it might have been.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now