Solved

my system tray icon's tooltip is not updating.

Posted on 2000-03-19
10
444 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
ID: 2633432
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
ID: 2633441
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
ID: 2633447
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:lmathers
ID: 2633489
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
ID: 2633532
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
 

Author Comment

by:lmathers
ID: 2633673
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
ID: 2633906
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
ID: 2633960
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
ID: 2633961
Thanks for taking time to help out.
0
 

Author Comment

by:lmathers
ID: 2633969
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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

685 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