Date: | January 10, 2005 / year-entry #7 |
Tags: | code |
Orig Link: | https://blogs.msdn.microsoft.com/oldnewthing/20050110-00/?p=36763 |
Comments: | 70 |
Summary: | The Shell_NotifyIcon function is used to do various things, among them, displaying a balloon tip to the user. As discussed in the documentation for the NOTIFYICONDATA structure, the uTimeout member specifies how long the balloon should be displayed. But what if the user is not at the computer when you display your balloon? After 30... |
The But what if the user is not at the computer when you display your balloon? After 30 seconds, the balloon will time out, and the user will have missed your important message! Never fear. The taskbar keeps track of whether the user is using the computer (with the help of the But what if you want to time out your message even if the user isn't there? You actually have the information available to you to solve this puzzle on the web pages I linked above. See if you can put the pieces together and come up with a better solution than simulating a click on the balloon. (Hint: Look carefully at what it means if you set your balloon text to an empty string.) And what if you want your message to stay on the screen longer than 30 seconds? You can't. The notification area enforces a 30 second limit for any single balloon. Because if they user hasn't done anything about it for 30 seconds, they probably aren't interested. If your message is so critical that the user shouldn't be allowed to ignore it, then don't use a notification balloon. Notification balloons are for non-critical transient messages to the user. |
Comments (70)
Comments are closed. |
Is there a way to surpress the marketroid-inspired balloons that always seem to appear and harass the user of a freshly minted workstation?
For that matter, XP likes to harras me about unused Icons on my desktop – can you disallow specific apps from using notifications?
you’d set your own timer, and when your timer triggers, set the NIF_INFO flag in uFlags and set szInfo to an empty string.
Like most of these features in Windows they’ve been abused to the point where they annoy the hell out of me. Sure, I wouldn’t mind knowing if my printer has caught fire, but "Windows is hiding your notification icons" isn’t something I have to be interrupted for.
Non-Microsoft applications are even worse. I wish I could just disable notification icons completely, or as Cooney said disallow specific apps. Disallowing specific apps is far too granular an option for Microsoft, though. ;)
Since I don’t use Windows XP regularly, the only one I see far too much of on my own machine is the "Wired Ethernet: The network cable is unplugged" one which comes up whenever my laptop comes out of hibernate. I don’t really need to know that (duh! I’m using wireless!) but since it happens during the time where I have to wait a few seconds for Windows to get its act together anyway it doesn’t bother me.
If I used Windows XP regularly I’d probably take the time to figure out how to suppress those little popups by force… but I can’t upgrade to Windows XP because the taskbar isn’t a tab control anymore so the ever-useful ButtonBoogie doesn’t work with it.
I’m wandering way off-topic, so I’ll stop here. :)
How do we tune down the duration of these patronising bits of junk. "take a tour of WinXP". , like I dont know my way round a four year old system.
I don’t see any option in SystemParametersInfo…is there something in the registry?
that would explain the problem i saw when trying to implement a baloon thingy for our product. I just could not get the ballon to go away, no matter what i put in the timeout. The problem was, of course, that i was just sitting there with a stop watch, staring at the screen waiting for it to go!
I do with programs like FeedDemon would use these balloon tips — their notifications just disappear after the time is up.
Windows Messenger has the same problem — its great be notified that someone is online, but it kind of stinks how easy it id to miss the notification….
Ben Cooke: I know it’s a bit obscure, but in WinXP you can choose which notification icons appear by right-clicking the notification area and selecting "Custom Notifications…"
I agree with Byron’s solution. I wonder if there is value in looking at the GetLastInputInfo return value both before you start waiting and at when you are done waiting. Then not bother to send that NULL string if the 2 "last input" values didn’t match?
"something I have to be interrupted for…"
Balloons aren’t interruptions. They’re just little notifications off to the side. They don’t take focus; you can just ignore them and 30 seconds later they will vanish.
Why is there a balloon to tell you that notification icons have been hidden? Isn’t it obvious from its existence? Because testing showed that without the balloon, the icons would vanish and people wouldn’t know where they went or how to get them back.
As for the desktop cleanup wizard: go to Control Panel > Display > Desktop tab > click Customize Desktop (at the bottom of the window). In the Desktop Items dialog that appears, General tab, uncheck "Run Desktop Cleanup Wizard every 60 days" and OK.
Now, why isn’t this preference stored by Files and Settings Transfer Wizard?
Thanks Mike!! you just made that comment while I was typing mine. Changing that setting right now…
Almost Anonymous: Right click the desktop, Properties->Desktop->Customize Desktop->General, uncheck Run Desktop Cleanup Wizard every 60 days.
Well, I know Shell_NotifyIcon won’t complain if an admin tries to mess with other processes’ notification icons. (Tested under 2000 SP3 and XP SP1. Don’t know about XPSP2.) Assuming you can find the HWND controlling the icons in question using Spy++, a little bit of brute force should find the relevant uID parameter.
With these two parameters, you can send a NIM_DELETE on that icon. Windows won’t allow any notification balloons from a nonexistent icon, so the app is effectively muzzled. (It might crash if it tests the return value from Shell_NotifyIcon when creating the balloons, but then again, it might not. Depends on the error-handling functionality.)
Of course, I won’t take the blame if this trick makes it into production code and Raymond has to rant about it in a year’s time…
CMV: Why do you claim that you aren’t to blame if people follow your advice?
Forgive my ignorance, but why is the LASTINPUTINFO structure a cbSize (saying how large the LASTINPUTINFO is) and then a tickcount? Why not just return a tickcount instead of requiring this structure? Future plans?
CMV probably doesn’t have the perspective or the testing department to make his personal trick into production code.
Sure, I might have liked to be told that the notification icons were being hidden the first time, but every time that stupid balloon appears now I want to scream "I KNOW!!!!" at it.
…and of course, the whole hiding icons thing is just a hack because so many applications create stupid notification icons.
Are the users who Microsoft calls in for usability testing so forgetful that they have to be constantly reminded of these things?
(As usual, because I only ever use Windows XP on other people’s computers turning off these annoying nag messages isn’t an option.)
Why not to implement notifications like e-mail ?
"You have 10 messages. 3 of them is argent".
So you could list them even if they disappear already. And (same as e-mail) you could make filters to mark some of them as SPAM ;)
I have seen some BlueTooth driver used notification to ask user to enter BT pincode. If you are not lucky you will miss it :)
ps. The thing I do not like is notification about empty space on disk. Especially for portable HDDs – they are full by definition :) And cleanup dialog with all items set to "0" is not good thing either ;)
Btw balloon tips DO have one hideous effect – they restore the taskbar.
What this means is that OACR (an internal tool that likes to pop up balloon help frequently) causes my taskbar to restore from auto-hide every time I do a build. Which knocks off about 3/4 of an inch of my screen realestate.
Ben: I don’t get the constant reminder; I get it once and that’s all. Once you dismiss the balloon, it remembers that you acknowledged the message and doesn’t remind you.
Michael Giagnocavo
CB Size is a version control thingy. For XP SP200 there may be additional elements to the structure (is human in front of computer from the camera) and the function can tell if it’s an old or new structure from the cbsize.
Though I don’t know what is wrong with version numbers.
"Though I don’t know what is wrong with version numbers."
That just adds another number to keep track of. "Was the szName field added in version 3 or version 4? I forget…"
Just on a tangent (recognising humans from camera), Intel need to put hardware neural networks onto the chip. This will open up (about 5 years after they do it) enourmous possibilities for software.
Amiga put sound chips on their computers and amiga became a defacto standard for audio.
Raymond, do you know if the GetLastInputInfo function ignores full screen things like Remote Desktop? That might explain why, when I establish a VPN connection and then RDP onto my work machine, the network connection notification icon often decides to pop up the "You’re connected to the VPN!" bubble when I close the Remote Desktop window.
Good point, James. This is a separate issue I neglected to call out in the original article. Balloons are suppressed when a fullscreen program is running. That way, you don’t get balloons popping up while you’re playing a video game or giving that PowerPoint presentation to your big client.
what we actually need is a "don’t show this tooltip again"… that way you would keep the ones you want and get rid of the ones that annoy you… that simple =o)
I also sometimes get the "eager" balloon that decides to pop back up again shortly after i closed it (on xp when using a dialup connection) … can pop up 3 or 4 times in a row.
XP at work has taken to ballooing me about the documents I print:
"Your document [abc] has been sent to the printer!" … How could I forget that? I told you to print it!
I really like the idea of blocking balloons from certain application as "Spam" :)
I don’t know what the deal is with that balloon. I suspect it’s because two components are operating simultaneously – one that does the prompting for passwords and another that recognizes new network connections.
All this discussion and ranting about how annoying they are and nobody has linked to http://support.microsoft.com/default.aspx?scid=kb;en-us;307729&sd=tech yet?
"Balloons aren’t interruptions. They’re just little notifications off to the side. They don’t take focus"
Actually they do take the focus… no, no, no.. not the Windows focus. They take mental focus. You’re sitting there typing out some comments into a web page and *pop* there’s this balloon which immediately distracts you.
So even though it doesn’t take keyboard focus, it’s still ANNOYING. I esspecially hate the unused-icons on the desktop one — how the heck do you turn that off! The tray icon does not go away after the baloon disappears, you have to open the wizard and then cancel it. I have to do that once a month.
When they do usability testing — do they ever do usability testing with average power users or is it always with newbies? A week with me and I could point out tonnes of usability issues — and they’d be easy to fix since I’m a power user and I doesn’t matter if the options I want are hard to find.
"I suspect it’s because two components are operating simultaneously"
Actually, that’s exactly what it seems like to me as well. It’s really not a case of designed-in annoying, it’s definately more like unintentional annoying.
Raymond, I hope you don’t mind always seemingly having to defend Microsoft after most of your articles.
And wow.. you can disable balloon messages; I guess that’s no surprise. Now I’m not sure if I really really want to do that. Are any balloon messages really helpful? (On my laptop, I’d think I’d missing the wireless notification ones).
"Raymond, I hope you don’t mind always seemingly having to defend Microsoft after most of your articles."
It’s frustrating bceause if I don’t respond to a charge, I am accused of ducking the question, even if the question isn’t in my area of expertise.
Cooney: You’re absolutely right–I’ve used the aforementioned trick only on my own machines, specifically because I *know* it has no business in production code. I’m not even sure where it would be useful in production code.
On the other hand, using it as a personalized hack to shut up a few annoying apps? No regrets whatsoever, even when SP3 or Longhorn changes the behavior and I have to abandon the utility. Nothing lost except a nice, quiet taskbar.
lazybones » All about ballons…
I find it amusing that ‘Almost Anonymous’ made the comment "I’m a power user and I doesn’t matter if the options I want are hard to find." while complaining about something that there is a hard to find option for.
Raymond: You should establish some sort of form letter for accusations you can’t answer. It’s amazing how powerful canned responses can be.
Does anyone else think that the documentation for GetLastInputInfo is extremely sparse? It would be helpful if it would explain why you would want to use that function, for example.
Another thing that makes MSDN harder to use than necessary is that you have to know what Windows versions they mean with ‘version 5’ and ‘version 6’. It’s probably defined somewhere, but not easy to find.
And, I also thought that many of the things that you discuss, Raymond, should actually be mentioned on the related MSDN pages. For example the fact that PulseEvent should not be used, or the warnings about using fibers. Maybe someone from the MSDN team should go through all your entire archive and add extra comments to the documentation where applicable?
Everytime I make a VPN connection I get a balloon. Which is funny, because *just* before that I have the connection dialog showing me that I’m connected, sending my username and password, and registering myself on the network. When it’s all completed I get the icon in the tray. Why do I need yet ANOTHER notification? Has Microsoft gone a bit baloon happy?
Has Microsoft underestimated how annoying these things are?
I happen to like the balloon notifications. They don’t require any interaction, so they don’t bother me.
It could have been worse. Imagine if clippy had migrated from Office 97 to do the job of announcing the notifications.
Raymond:
>It’s frustrating bceause if I don’t respond to a
>charge, I am accused of ducking the question, even if
>the question isn’t in my area of expertise.
Just to note that the articles are (usually :) interesting and appreciated, even if looking at COM code tends to give me a headache… ;-)
@Frederik: Perhaps you choose bad examples to prove your point. MSDN clearly states that PulseEvent should not be used. It usually has good versioning info at the bottom of each page (OS, header and lib). Shell functions marked with "Version x" usually have a direct hyperlink to a page describing which version of IE must be installed.
Sorry… Psuedo off topic, but probably of interest to readers anyway. Technet article 307729 describes how to get rid of notification area balloons.
http://support.microsoft.com/default.aspx?scid=kb;en-us;307729&sd=tech
Taskbar ballon notifications are overused, and should be considered harmful.
Because they don’t remove keyboard focus from the current application, too many app developers have used them to notify the user of something which would never have receieved a dialog-box in the first place; things which would have been done with a toolbar button changing color (like a macro running) or with an icon change.
It annoys me hugely that VS.NET 2003/5 pops up a balloon when a macro starts running, mostly because I run up to 3 macros a second – they’re bound to normal keys like "Home" and "Shift-Home".
The reason they should be considered harmful is that the user is not notified *at all* when they turn off balloon notification. On my home PC, I turned off notification, and now I never get informed about why my PC couldn’t hibernate (I have to look in the Event Log), about whether an attempt to disconnect my pen drive succeeded or not (I just get mute icon flicker in the notification area, no tooltips or anything), and that annoying "Clean Up Desktop" might hang around for a week before I get around to getting rid of it.
Say, I have a stupid question. At home, I have XP set up for multiple users at a time, so I usually just "switch users" rather than fully log out. When I come home and log back in, it usually takes some time to redraw everything, what with the two (?) instances of screensavers, but at the beginning of the first pass it looks like I get a bunch of notification balloons that instantly disappear. What’s up with that?
I think we need a way to turn the pop-up balloons into Clippy. But then we’d need a way to have them display incorrect messages.
Like for example, after printing, clippy could show up and :
(tap)(tap)(tap)It appears that you have a new network connection!
Mostly-related question. Is there any way to turn-off or slow the reminder mechanism for Windows Update downloads that want you to reboot your machine. It’s a total PITA having it pop up every few minutes, grab the focus and reboot your machine cause you were typing at the time. I’ve had to restart long downloads and sometimes lost data as a consequence of the over-aggressive behaviour of this notification.
I found a way to do that. When the window comes up don’t click "reboot later" just leave it. Now it’ll never bother you again. If you want you can even drag it down to the bottom right of the screen securely out of the way.
Or if you’re like me and have an excellent program called The Wonderful Icon (http://www.thewonderfulicon.com/) then you can assign a shortcut (or use the menu) to "hide" the window… that way it isn’t on screen or in the taskbar. Excellent stuff.
On a semi-related note, is it somehow possible to disable automatic taskbar restore completely?
I really couldn’t care less if some program has opened a window or shown a popup and I find the taskbar popup to be very annoying. It should stay hidden until I move the mouse over it.
If anyone doesn’t fancy hacking the registry to disable balloon notifications, there’s an option in TweakUI for it. Under Taskbar and Start Menu, uncheck "Enable balloon tips".
Get TweakUI from http://www.microsoft.com/windowsxp/downloads/powertoys/xppowertoys.mspx. It’s one of the first things I install on a new machine – I’ve always hated the default look of shortcut arrows. The ‘light arrow’ option is far less obtrusive.
"The reason they should be considered harmful is that the user is not notified *at all* when they turn off balloon notification."
So again – if there would be something like Inbox or EventLog for all balloons and single tray icon to show activity of balloons for last minute(?) then you could just disable them and use only when you awaiting for some message (BT id code is an example).
This morning I had a balloon tip showing about 60% of the text that it intended to show. Two lines, the right-hand 60% of the text that was intended for the first line and the right-hand 60% of the text that was intended for the second line. I assume this is because two drivers wanted to show their balloons at the same time, one of them won the battle for the balloon’s size, and the other won the battle for whatever fraction of its text would fit in that size.
Even if Microsoft doesn’t consider the balloon notifications ‘interruptions’ by their definitions, I, being the owner of the computer and the licensed user of the operating system, would certainly appreciate the ability to dictate to my machine what I will and won’t be distracted with.
I hate ‘are you sure?’ dialogs. They slow you down when you DO know what you’re doing, but need to do it a LOT and QUICKLY.
I hate balloon notifications. I’m a big fan of "Management by exception" so if things are catching fire, sure, let me know. If everything’s working just fine, I should have the option to tell the programs "Shut up and don’t bother me unless something’s broken."
As I continuously rant, "I’m installing a program, not a lifestyle." I want my programs to do their proper jobs as silently as possible, not provide repetitious distractions and/or the need to respond to superfluous dialog boxes.
Sure, those notifications are useful for the uninitiated, but I want a way to shut them off as I see fit, even if it’s an obscure registry key. I want my computer to allow me the ability to CONCENTRATE on my job, not jerk me around because it thinks I want to know about every print job, every network connection, every unused icon…
I’m A.D.D. enough without Microsoft’s help, thankyouverymuch.
I HATE that feature!
Especially that stupid ‘wireless network connected!" "Wireless network disconnected!" "Wireless network on fire!"
I am wondering why Apple OS X does not have one. Maybe because they actually figured out that the feature is indeed STUPID and ANNOYING. Yellow color even in the peripheral vision DISTRACTS you. Have you noticed that it is very difficult not to stare at incoming car lights? For the same very reason balloons must die.
MessageBeep that beeps even if sound scheme is NO SOUNDS must die too.
Raymond said:
> Balloons aren’t interruptions. They’re just
> little notifications off to the side. They
> don’t take focus; you can just ignore them
> and 30 seconds later they will vanish.
Well, it all depends on how you use your computer. When a balloon comes up–say to tell me that my wireless connection is now connected–I click on the close box to dismiss it. Why? Because I want to. I’ve read the message and now I want it gone.
Unfortunately, when you do that it steals focus from the active app. I guess focus goes to the task bar or something. I think that’s a bug. Closing a balloon should not take away focus.
The other problem with notification balloons if that they often don’t give a user a way to make them never come back. The desktop cleanup wizard one is probably the worst. Several people in this discussion didn’t know how to make it go away, and most of my friends and relatives certainly don’t. I know because they ask me. It annoys people, and they can’t make it go away. That isn’t really a notification balloon problem per se, it’s a problem with how some programmers use them.
"And what if you want your message to stay on the screen longer than 30 seconds?
You can’t. The notification area enforces a 30 second limit for any single balloon."
Then why don’t the ‘you have no virus scanner installed’ and ‘there are new updates available’ balloons go away until I click them?
? They go away for me when I click on the X.
That’s my point. Where is that 30 second limit?
Since when When == Until ?
Select Run from the Start button.
Type in regedit in the Open: field.
Hit Enter or click OK. This opens the Registry Editor.
Select the folder HKEY_CURRENT_USER and then follow the folder path softwaremicrosoftwindowscurrentversionexploreradvanced.
From the Registry Edit menu, select Edit/New/DWORD Value. A new value will appear in the right-hand pane.
Type EnableBalloonTips and hit Enter.
Close the Registry Editor.
Log off from Windows XP and then log on again to enable the change.
voila!
A:
Obviously the rules do not apply to Microsoft. Always has been, always will be.
Note that you can turn off most of the really stupid things like the XP tour, ‘Click start to start’ ‘Where are my programs’ ‘You have unused icons’ and so on using group policy.
I once heard someone talk about taking a quiz before using your computer to prove that you are not a moron, and you do not need to be treated like one. I guess this is it.
The Tour and Unused icons balloons follow the same rules as other balloons.
The question was about the ‘You have no virusscanner’ and ‘There are new updates’ balloons.
Those also follow the balloon rules. Any balloon that comes from a notification icon follows the rules enforced by the notification area.
Okay, then I retract my statement. Great reply speed, by the way!
I think I am getting a severe penalty in some cases.
A VB program starts by displaying a form, maximized with no buttons for minimize or maximize or close or anything. (The PC controls an industrial system and this application owns the user interface.)
A few milliseconds after start-up it displays another form on top of that, saying "Please Wait". After it finishes initializing itself it hides or unloads the "Please Wait" form.
Now for the problem that occurs sometimes:
During the time that the "Please Wait" form is being displayed, Windows Update displays a balloon tip asking the user to enable Windows Update. When the balloon appears, the task bar and some other stuff also appear.
If the user clicks the "X" in the balloon then the balloon goes away, AND the Z-order of the application’s two forms gets screwed up. The "Please Wait" form goes to the bottom and the main form becomes visible. Fortunately the cursor is still an hourglass so this is a minor issue up to this point.
Then the application tries to hide or unload the "Please Wait" form, and the application crashes with an error about an invalid procedure call.
The problem is that the VB application is so badly designed. Don’t they know about modal windows or top most windows? And I’m still amused of how the application handled the disposing of the "Please Wait" window that made it crash if the windows isn’t on top. If all the application is build in the same way, I hope it doesn’t control very critical environments…
Also, I want to ask Raymond: The delay in starting up the timeout when there is no activity is only present in Windows XP and up, isn’t it? I usually work with Windows 2000 and the balloon notifications disapear even if there isn’t user interaction.