0

I am working on a very big and complex application for Windows written in C++ and using MFC.

I am working on this bug, where if a user presses on a balloon tooltip, it won't close, only after a timeout.

The thing is that I got the NIN_BALLOONUSERCLICK event and managed to close the tooltip, but I can't seem to catch the event raised when the user presses on the "X" button in the upper right corner.

Can anyone help me? What event should I look for? I've spent around 3 days of searching the Internet, but no one seems to know of a way.

If you can tell me how to make the "X" close button disappear, that would be okay, too!

Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
eladyanai
  • 1,063
  • 2
  • 15
  • 34

1 Answers1

1

The reason you can't find any such event is because one does not exist. It is not possible to distinguish between the balloon being closed because the user clicked somewhere on it and the balloon being dismissed because the user clicked specifically on the close ("X") button.

More information can be found in this article on Raymond Chen's blog: Why don't notification icons get a message when the user clicks the "X" button?

Basically, the event doesn't exist to keep you from doing bad things, like annoying your users. There's absolutely no reason that you should need to do something different based on how the user dismissed the balloon notification.

Making the "X" button disappear is definitely the wrong choice. Asking for that makes it sound like you're exactly the developer that the Windows Shell team was trying to protect us from. Glad someone has our back as unsuspecting users of your application. Users like to be able to dismiss things. Usability studies have repeatedly indicate that it's extremely stressful and confusing for users when there is no "Cancel" button. You need to work within the constraints of sensible, user-friendly design.

NIN_BALLOONUSERCLICK is the right choice. The tooltip will be dismissed when the user clicks on it. The documentation explains all of the various notifications that are available in greater detail.

Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
  • Hello Cody Gray, Thank You Very Much for you'r answer. and don't worry, i am not the kind of programmer that windows is saving you from, my problem is that my notification class is a singleton and when i get the event NIN_BALLOONUSERCLICK i make its variables = NULL. but when the user press on the X i dont get the event and the tooltip would re-open again and again untill timeout OR NIN_BALLOONUSERCLICK. – eladyanai Jul 17 '11 at 13:19
  • can you please help me find a solution for this? – eladyanai Jul 17 '11 at 13:26
  • @eladyanai22: There's no reason to show the tooltip again if either the `NIN_BALLOONUSERCLICK` or `NIN_BALLOONTIMEOUT` flags are returned. You should get `NIN_BALLOONTIMEOUT` when either the balloon times out or when the user clicks the "X". – Cody Gray - on strike Jul 17 '11 at 13:29
  • i know there is no reason to show the tooltip again, but this is the bug, i want to close it when the user presses on the X and make all of my class variables NULL, otherwise it will pop up again! i will try what you say'd about timeout. – eladyanai Jul 17 '11 at 13:37