?
Solved

my system tray icon's tooltip is not updating.

Posted on 2000-03-19
10
Medium Priority
?
462 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
[X]
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
  • 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

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 150 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

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

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…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
Suggested Courses
Course of the Month9 days, 14 hours left to enroll

762 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