Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

my system tray icon's tooltip is not updating.

Posted on 2000-03-19
10
442 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
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

860 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