开发者

What event is sent by a click on the "X" close button for an MFC balloon tooltip?

开发者 https://www.devze.com 2023-03-21 01:09 出处:网络
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 time

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 w开发者_如何学Pythonhen 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!


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号